#include "D3D_Conversion.h"
#include "DIS_RenderStates.h"


DIS_RESULT HR_to_DR( HRESULT r )
{
	switch( r )
	{
	case D3D_OK: return DIS_OK;
	case E_FAIL: return DIS_FAIL;
	case D3DERR_INVALIDCALL: return DIS_ERR_INVALIDCALL;
	case D3DERR_OUTOFVIDEOMEMORY: return DIS_ERR_OUTOFVIDEOMEMORY; 
	case E_OUTOFMEMORY: return DIS_RESULT::DIS_E_OUTOFMEMORY;	
	default: 
		return DIS_FAIL;
	};
}

void Copy_D3DMATRIX_To_DIS_MATRIX( const D3DMATRIX &in, DIS_MATRIX &out )
{
	for( UInt32 i =0; i < 4; i++ )
	{
		for( UInt32 j = 0; j < 4; j++)
		{
			out.m[i][j] = in.m[i][j];
		}
	}
}

void Copy_DIS_MATRIX_To_D3DMATRIX( const DIS_MATRIX &in,  D3DMATRIX &out )
{
	for( UInt32 i =0; i < 4; i++ )
	{
		for( UInt32 j = 0; j < 4; j++)
		{
			out.m[i][j] = in.m[i][j];
		}
	}
}

DIS_D3DConversion::DIS_D3DConversion()
{
	// set all non-used states to zero
	memset((void*)this, 0, sizeof(this));

	D3DtoDIS_BackBuffer[D3DBACKBUFFER_TYPE_MONO] =	DIS_BACKBUFFER_TYPE_MONO;
	D3DtoDIS_BackBuffer[D3DBACKBUFFER_TYPE_LEFT] =	DIS_BACKBUFFER_TYPE_LEFT;
	D3DtoDIS_BackBuffer[D3DBACKBUFFER_TYPE_RIGHT] = DIS_BACKBUFFER_TYPE_RIGHT;

	D3DtoDIS_BasisType[D3DBASIS_BEZIER] =		DIS_BASIS_BEZIER;
	D3DtoDIS_BasisType[D3DBASIS_BSPLINE] =		DIS_BASIS_BSPLINE;
	D3DtoDIS_BasisType[D3DBASIS_CATMULL_ROM] =	DIS_BASIS_CATMULL_ROM;

	D3DtoDIS_BlendType[D3DBLEND_ZERO] =				DIS_BLEND_ZERO;
	D3DtoDIS_BlendType[D3DBLEND_ONE] =				DIS_BLEND_ONE;
	D3DtoDIS_BlendType[D3DBLEND_SRCCOLOR] =			DIS_BLEND_SRCCOLOR;
	D3DtoDIS_BlendType[D3DBLEND_INVSRCCOLOR] =		DIS_BLEND_INVSRCCOLOR;
	D3DtoDIS_BlendType[D3DBLEND_SRCALPHA] =			DIS_BLEND_SRCALPHA;
	D3DtoDIS_BlendType[D3DBLEND_INVSRCALPHA] =		DIS_BLEND_INVSRCALPHA;
	D3DtoDIS_BlendType[D3DBLEND_DESTALPHA] =		DIS_BLEND_DESTALPHA;
	D3DtoDIS_BlendType[D3DBLEND_INVDESTALPHA] =		DIS_BLEND_INVDESTALPHA;
	D3DtoDIS_BlendType[D3DBLEND_DESTCOLOR] =		DIS_BLEND_DESTCOLOR;
	D3DtoDIS_BlendType[D3DBLEND_INVDESTCOLOR] =		DIS_BLEND_INVDESTCOLOR;
	D3DtoDIS_BlendType[D3DBLEND_SRCALPHASAT] =		DIS_BLEND_SRCALPHASAT;
	D3DtoDIS_BlendType[D3DBLEND_BOTHSRCALPHA] =		DIS_BLEND_BOTHSRCALPHA;
	D3DtoDIS_BlendType[D3DBLEND_BOTHINVSRCALPHA] =	DIS_BLEND_BOTHINVSRCALPHA;
	D3DtoDIS_BlendType[D3DBLEND_BLENDFACTOR] =		DIS_BLEND_BLENDFACTOR;
	D3DtoDIS_BlendType[D3DBLEND_INVBLENDFACTOR] =	DIS_BLEND_INVBLENDFACTOR;
	D3DtoDIS_BlendType[D3DBLEND_SRCCOLOR2] =		DIS_BLEND_SRCCOLOR2;
	D3DtoDIS_BlendType[D3DBLEND_INVSRCCOLOR2] =		DIS_BLEND_INVSRCCOLOR2;

	D3DtoDIS_BlendOp[D3DBLENDOP_ADD]			= DIS_BLENDOP_ADD;
	D3DtoDIS_BlendOp[D3DBLENDOP_SUBTRACT]		= DIS_BLENDOP_SUBTRACT;
	D3DtoDIS_BlendOp[D3DBLENDOP_REVSUBTRACT]	= DIS_BLENDOP_REVSUBTRACT;
	D3DtoDIS_BlendOp[D3DBLENDOP_MIN]			= DIS_BLENDOP_MIN;
	D3DtoDIS_BlendOp[D3DBLENDOP_MAX]			= DIS_BLENDOP_MAX;

	D3DtoDIS_CmpFunc[D3DCMP_NEVER]				= DIS_CMP_NEVER;
	D3DtoDIS_CmpFunc[D3DCMP_LESS]				= DIS_CMP_LESS;
	D3DtoDIS_CmpFunc[D3DCMP_EQUAL]				= DIS_CMP_EQUAL;
	D3DtoDIS_CmpFunc[D3DCMP_LESSEQUAL]			= DIS_CMP_LESSEQUAL;
	D3DtoDIS_CmpFunc[D3DCMP_GREATER]			= DIS_CMP_GREATER;
	D3DtoDIS_CmpFunc[D3DCMP_NOTEQUAL]			= DIS_CMP_NOTEQUAL;
	D3DtoDIS_CmpFunc[D3DCMP_ALWAYS]				= DIS_CMP_ALWAYS;
	D3DtoDIS_CmpFunc[D3DCMP_NEVER]				= DIS_CMP_NEVER;


	D3DtoDIS_ComposerOp[D3DCOMPOSERECTS_COPY]	= DIS_COMPOSERECTS_COPY;
	D3DtoDIS_ComposerOp[D3DCOMPOSERECTS_OR]		= DIS_COMPOSERECTS_OR;
	D3DtoDIS_ComposerOp[D3DCOMPOSERECTS_AND]    = DIS_COMPOSERECTS_AND;
	D3DtoDIS_ComposerOp[D3DCOMPOSERECTS_NEG]	= DIS_COMPOSERECTS_NEG;

  
	D3DtoDIS_CubemapFaces[D3DCUBEMAP_FACE_POSITIVE_X]	= DIS_CUBEMAP_FACE_POSITIVE_X;
	D3DtoDIS_CubemapFaces[D3DCUBEMAP_FACE_NEGATIVE_X]	= DIS_CUBEMAP_FACE_NEGATIVE_X;
	D3DtoDIS_CubemapFaces[D3DCUBEMAP_FACE_POSITIVE_Y]	= DIS_CUBEMAP_FACE_POSITIVE_Y;
	D3DtoDIS_CubemapFaces[D3DCUBEMAP_FACE_NEGATIVE_Y]	= DIS_CUBEMAP_FACE_NEGATIVE_Y;
	D3DtoDIS_CubemapFaces[D3DCUBEMAP_FACE_POSITIVE_Z]	= DIS_CUBEMAP_FACE_POSITIVE_Z;
	D3DtoDIS_CubemapFaces[D3DCUBEMAP_FACE_NEGATIVE_Z]	= DIS_CUBEMAP_FACE_NEGATIVE_Z;

	D3DtoDIS_CullMode[D3DCULL_NONE]			= DIS_CULL_NONE;
	D3DtoDIS_CullMode[D3DCULL_CW]			= DIS_CULL_CW;
	D3DtoDIS_CullMode[D3DCULL_CCW]			= DIS_CULL_CCW;

	D3DtoDIS_DebugMonitorTokens[D3DDMT_ENABLE] = DIS_DMT_ENABLE;
	D3DtoDIS_DebugMonitorTokens[D3DDMT_DISABLE] = DIS_DMT_DISABLE;

	D3DtoDIS_DeclMethod[D3DDECLMETHOD_DEFAULT]			= DIS_DECLMETHOD_DEFAULT;
	D3DtoDIS_DeclMethod[D3DDECLMETHOD_PARTIALU]			= DIS_DECLMETHOD_PARTIALU;
	D3DtoDIS_DeclMethod[D3DDECLMETHOD_PARTIALV]			= DIS_DECLMETHOD_PARTIALV;
	D3DtoDIS_DeclMethod[D3DDECLMETHOD_CROSSUV]			= DIS_DECLMETHOD_CROSSUV;
	D3DtoDIS_DeclMethod[D3DDECLMETHOD_UV]				= DIS_DECLMETHOD_UV;
	D3DtoDIS_DeclMethod[D3DDECLMETHOD_LOOKUP]			= DIS_DECLMETHOD_LOOKUP;
	D3DtoDIS_DeclMethod[D3DDECLMETHOD_LOOKUPPRESAMPLED]	= DIS_DECLMETHOD_LOOKUPPRESAMPLED;

	D3DtoDIS_DeclType[D3DDECLTYPE_FLOAT1     ] = DIS_DECLTYPE_FLOAT1;
	D3DtoDIS_DeclType[D3DDECLTYPE_FLOAT2     ] =	DIS_DECLTYPE_FLOAT2;
	D3DtoDIS_DeclType[D3DDECLTYPE_FLOAT3     ] =	DIS_DECLTYPE_FLOAT3;
	D3DtoDIS_DeclType[D3DDECLTYPE_FLOAT4     ] =	DIS_DECLTYPE_FLOAT4;
	D3DtoDIS_DeclType[D3DDECLTYPE_D3DCOLOR   ] =	DIS_DECLTYPE_DIS_COLOR;
	D3DtoDIS_DeclType[D3DDECLTYPE_UBYTE4     ] =	DIS_DECLTYPE_UBYTE4;
	D3DtoDIS_DeclType[D3DDECLTYPE_SHORT2     ] =	DIS_DECLTYPE_SHORT2;
	D3DtoDIS_DeclType[D3DDECLTYPE_SHORT4     ] =	DIS_DECLTYPE_SHORT4;
	D3DtoDIS_DeclType[D3DDECLTYPE_UBYTE4N    ] =	DIS_DECLTYPE_UBYTE4N;
	D3DtoDIS_DeclType[D3DDECLTYPE_SHORT2N    ] =	DIS_DECLTYPE_SHORT2N;
	D3DtoDIS_DeclType[D3DDECLTYPE_SHORT4N    ] =	DIS_DECLTYPE_SHORT4N;
	D3DtoDIS_DeclType[D3DDECLTYPE_USHORT2N   ] =	DIS_DECLTYPE_USHORT2N;
	D3DtoDIS_DeclType[D3DDECLTYPE_USHORT4N   ] =	DIS_DECLTYPE_USHORT4N;
	D3DtoDIS_DeclType[D3DDECLTYPE_UDEC3      ] =	DIS_DECLTYPE_UDEC3;
	D3DtoDIS_DeclType[D3DDECLTYPE_DEC3N      ] =	DIS_DECLTYPE_DEC3N;
	D3DtoDIS_DeclType[D3DDECLTYPE_FLOAT16_2  ] =	DIS_DECLTYPE_FLOAT16_2;
	D3DtoDIS_DeclType[D3DDECLTYPE_FLOAT16_4  ] =	DIS_DECLTYPE_FLOAT16_4;
	D3DtoDIS_DeclType[D3DDECLTYPE_UNUSED     ] =	DIS_DECLTYPE_UNUSED;

	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_POSITION      ]  =	DIS_DECLUSAGE_POSITION;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_BLENDWEIGHT   ]  =	DIS_DECLUSAGE_BLENDWEIGHT;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_BLENDINDICES  ]  =	DIS_DECLUSAGE_BLENDINDICES;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_NORMAL        ]  =	DIS_DECLUSAGE_NORMAL;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_PSIZE         ]  =	DIS_DECLUSAGE_PSIZE;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_TEXCOORD      ]  =	DIS_DECLUSAGE_TEXCOORD;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_TANGENT       ]  =	DIS_DECLUSAGE_TANGENT;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_BINORMAL      ]  =	DIS_DECLUSAGE_BINORMAL;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_TESSFACTOR    ]  =	DIS_DECLUSAGE_TESSFACTOR;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_POSITIONT     ]  =	DIS_DECLUSAGE_POSITIONT;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_COLOR         ]  =	DIS_DECLUSAGE_COLOR;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_FOG           ]  =	DIS_DECLUSAGE_FOG;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_DEPTH         ]  =	DIS_DECLUSAGE_DEPTH;
	D3DtoDIS_DeclUsage[ D3DDECLUSAGE_SAMPLE        ]  =	DIS_DECLUSAGE_SAMPLE; 
	
	D3DtoDIS_DegreeType[ D3DDEGREE_LINEAR     ] = DIS_DEGREE_LINEAR;
	D3DtoDIS_DegreeType[ D3DDEGREE_QUADRATIC  ] = DIS_DEGREE_QUADRATIC;
	D3DtoDIS_DegreeType[ D3DDEGREE_CUBIC      ] = DIS_DEGREE_CUBIC;
	D3DtoDIS_DegreeType[ D3DDEGREE_QUINTIC    ] = DIS_DEGREE_QUINTIC;
	
	D3DtoDIS_DevType[ D3DDEVTYPE_HAL          ]  = DIS_DEVTYPE_HAL;
	D3DtoDIS_DevType[ D3DDEVTYPE_NULLREF      ]  = DIS_DEVTYPE_NULLREF;
	D3DtoDIS_DevType[ D3DDEVTYPE_REF          ]  = DIS_DEVTYPE_REF;
	D3DtoDIS_DevType[ D3DDEVTYPE_SW           ]  = DIS_DEVTYPE_SW;

	D3DtoDIS_DisplayRotation[ D3DDISPLAYROTATION_IDENTITY  ]  = DIS_DISPLAYROTATION_IDENTITY;
	D3DtoDIS_DisplayRotation[ D3DDISPLAYROTATION_90        ]  = DIS_DISPLAYROTATION_90;
	D3DtoDIS_DisplayRotation[ D3DDISPLAYROTATION_180       ]  = DIS_DISPLAYROTATION_180;
	D3DtoDIS_DisplayRotation[ D3DDISPLAYROTATION_270       ]  = DIS_DISPLAYROTATION_270;

	D3DtoDIS_FillMode[ D3DFILL_POINT        ]  = DIS_FILL_POINT;
	D3DtoDIS_FillMode[ D3DFILL_WIREFRAME    ]  = DIS_FILL_WIREFRAME;
	D3DtoDIS_FillMode[ D3DFILL_SOLID        ]  = DIS_FILL_SOLID;

	D3DtoDIS_FogMode[ D3DFOG_NONE         ]  = DIS_FOG_NONE;
	D3DtoDIS_FogMode[ D3DFOG_EXP          ]  = DIS_FOG_EXP;
	D3DtoDIS_FogMode[ D3DFOG_EXP2         ]  = DIS_FOG_EXP2;
	D3DtoDIS_FogMode[ D3DFOG_LINEAR       ]  = DIS_FOG_LINEAR;

	D3DtoDIS_Format[ D3DFMT_UNKNOWN              ] = DIS_FMT_UNKNOWN;
    D3DtoDIS_Format[ D3DFMT_R8G8B8               ] = DIS_FMT_R8G8B8;
    D3DtoDIS_Format[ D3DFMT_A8R8G8B8             ] = DIS_FMT_A8R8G8B8;
    D3DtoDIS_Format[ D3DFMT_X8R8G8B8             ]  = DIS_FMT_X8R8G8B8;
    D3DtoDIS_Format[ D3DFMT_R5G6B5               ]  = DIS_FMT_R5G6B5;
    D3DtoDIS_Format[ D3DFMT_X1R5G5B5             ]  = DIS_FMT_X1R5G5B5;
    D3DtoDIS_Format[ D3DFMT_A1R5G5B5             ]  = DIS_FMT_A1R5G5B5;
    D3DtoDIS_Format[ D3DFMT_A4R4G4B4             ]  = DIS_FMT_A4R4G4B4;
    D3DtoDIS_Format[ D3DFMT_R3G3B2               ]  = DIS_FMT_R3G3B2;
    D3DtoDIS_Format[ D3DFMT_A8                   ]  = DIS_FMT_A8;
    D3DtoDIS_Format[ D3DFMT_A8R3G3B2             ]  = DIS_FMT_A8R3G3B2;
    D3DtoDIS_Format[ D3DFMT_X4R4G4B4             ]  = DIS_FMT_X4R4G4B4;
    D3DtoDIS_Format[ D3DFMT_A2B10G10R10          ]  = DIS_FMT_A2B10G10R10;
    D3DtoDIS_Format[ D3DFMT_A8B8G8R8             ]  = DIS_FMT_A8B8G8R8;
    D3DtoDIS_Format[ D3DFMT_X8B8G8R8             ]  = DIS_FMT_X8B8G8R8;
    D3DtoDIS_Format[ D3DFMT_G16R16               ]  = DIS_FMT_G16R16;
    D3DtoDIS_Format[ D3DFMT_A2R10G10B10          ]  = DIS_FMT_A2R10G10B10;
    D3DtoDIS_Format[ D3DFMT_A16B16G16R16         ]  = DIS_FMT_A16B16G16R16;
    D3DtoDIS_Format[ D3DFMT_A8P8                 ]  = DIS_FMT_A8P8;
    D3DtoDIS_Format[ D3DFMT_P8                   ]  = DIS_FMT_P8;
    D3DtoDIS_Format[ D3DFMT_L8                   ]  = DIS_FMT_L8;
    D3DtoDIS_Format[ D3DFMT_A8L8                 ]  = DIS_FMT_A8L8;
    D3DtoDIS_Format[ D3DFMT_A4L4                 ]  = DIS_FMT_A4L4;
    D3DtoDIS_Format[ D3DFMT_V8U8                 ]  = DIS_FMT_V8U8;
    D3DtoDIS_Format[ D3DFMT_L6V5U5               ]  = DIS_FMT_L6V5U5;
    D3DtoDIS_Format[ D3DFMT_X8L8V8U8             ]  = DIS_FMT_X8L8V8U8;
    D3DtoDIS_Format[ D3DFMT_Q8W8V8U8             ]  = DIS_FMT_Q8W8V8U8;
    D3DtoDIS_Format[ D3DFMT_V16U16               ]  = DIS_FMT_V16U16;
    D3DtoDIS_Format[ D3DFMT_A2W10V10U10          ]  = DIS_FMT_A2W10V10U10;
/*    D3DtoDIS_Format[ D3DFMT_UYVY                 ] = DIS_FMT_UYVY;
    D3DtoDIS_Format[ D3DFMT_R8G8_B8G8            ]  = DIS_FMT_R8G8_B8G8;
    D3DtoDIS_Format[ D3DFMT_YUY2                 ] = DIS_FMT_YUY2;
    D3DtoDIS_Format[ D3DFMT_G8R8_G8B8            ]  = DIS_FMT_G8R8_G8B8;
    D3DtoDIS_Format[ D3DFMT_DXT1                 ]  = DIS_FMT_DXT1;
    D3DtoDIS_Format[ D3DFMT_DXT2                 ]  = DIS_FMT_DXT2;
    D3DtoDIS_Format[ D3DFMT_DXT3                 ]  = DIS_FMT_DXT3;
    D3DtoDIS_Format[ D3DFMT_DXT4                 ]  = DIS_FMT_DXT4;
    D3DtoDIS_Format[ D3DFMT_DXT5                 ]  = DIS_FMT_DXT5;
 */   
	D3DtoDIS_Format[ D3DFMT_D16_LOCKABLE         ]  = DIS_FMT_D16_LOCKABLE;
    D3DtoDIS_Format[ D3DFMT_D32                  ]  = DIS_FMT_D32;
    D3DtoDIS_Format[ D3DFMT_D15S1                ]  = DIS_FMT_D15S1;
    D3DtoDIS_Format[ D3DFMT_D24S8                ]  = DIS_FMT_D24S8;
    D3DtoDIS_Format[ D3DFMT_D24X8                ]  = DIS_FMT_D24X8;
    D3DtoDIS_Format[ D3DFMT_D24X4S4              ]  = DIS_FMT_D24X4S4;
    D3DtoDIS_Format[ D3DFMT_D16                  ]  = DIS_FMT_D16;
    D3DtoDIS_Format[ D3DFMT_D32F_LOCKABLE        ]  = DIS_FMT_D32F_LOCKABLE;
    D3DtoDIS_Format[ D3DFMT_D24FS8               ]  = DIS_FMT_D24FS8;
    D3DtoDIS_Format[ D3DFMT_D32_LOCKABLE         ]  = DIS_FMT_D32_LOCKABLE;
    D3DtoDIS_Format[ D3DFMT_S8_LOCKABLE          ]  = DIS_FMT_S8_LOCKABLE;
    D3DtoDIS_Format[ D3DFMT_L16                  ]  = DIS_FMT_L16;
    D3DtoDIS_Format[ D3DFMT_VERTEXDATA           ] = DIS_FMT_VERTEXDATA;
    D3DtoDIS_Format[ D3DFMT_INDEX16              ] = DIS_FMT_INDEX16;
    D3DtoDIS_Format[ D3DFMT_INDEX32              ] = DIS_FMT_INDEX32;
    D3DtoDIS_Format[ D3DFMT_Q16W16V16U16         ] = DIS_FMT_Q16W16V16U16;
//    D3DtoDIS_Format[ D3DFMT_MULTI2_ARGB8         ] = DIS_FMT_MULTI2_ARGB8;
    D3DtoDIS_Format[ D3DFMT_R16F                 ]  = DIS_FMT_R16F;
    D3DtoDIS_Format[ D3DFMT_G16R16F              ]  = DIS_FMT_G16R16F;
    D3DtoDIS_Format[ D3DFMT_A16B16G16R16F        ]  = DIS_FMT_A16B16G16R16F;
    D3DtoDIS_Format[ D3DFMT_R32F                 ]  = DIS_FMT_R32F;
    D3DtoDIS_Format[ D3DFMT_G32R32F              ]  = DIS_FMT_G32R32F;
    D3DtoDIS_Format[ D3DFMT_A32B32G32R32F        ]  = DIS_FMT_A32B32G32R32F;
    D3DtoDIS_Format[ D3DFMT_CxV8U8               ]  = DIS_FMT_CxV8U8;
    D3DtoDIS_Format[ D3DFMT_A1                   ]  = DIS_FMT_A1;
    D3DtoDIS_Format[ D3DFMT_A2B10G10R10_XR_BIAS  ]  = DIS_FMT_A2B10G10R10_XR_BIAS;
    D3DtoDIS_Format[ D3DFMT_BINARYBUFFER         ]  = DIS_FMT_BINARYBUFFER;

	D3DtoDIS_LightType[ D3DLIGHT_POINT        ]  = DIS_LIGHT_POINT;
	D3DtoDIS_LightType[ D3DLIGHT_SPOT         ]  = DIS_LIGHT_SPOT;
	D3DtoDIS_LightType[ D3DLIGHT_DIRECTIONAL  ]  = DIS_LIGHT_DIRECTIONAL;

	D3DtoDIS_MaterialColorSource[ D3DMCS_MATERIAL        ]  = DIS_MCS_MATERIAL;
	D3DtoDIS_MaterialColorSource[ D3DMCS_COLOR1         ]  = DIS_MCS_COLOR1;
	D3DtoDIS_MaterialColorSource[ D3DMCS_COLOR2  ]  = DIS_MCS_COLOR2;

	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_NONE          ]  = DIS_MULTISAMPLE_NONE;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_NONMASKABLE   ]  = DIS_MULTISAMPLE_NONMASKABLE;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_2_SAMPLES     ]  = DIS_MULTISAMPLE_2_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_3_SAMPLES     ]  = DIS_MULTISAMPLE_3_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_4_SAMPLES     ]  = DIS_MULTISAMPLE_4_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_5_SAMPLES     ]  = DIS_MULTISAMPLE_5_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_6_SAMPLES     ]  = DIS_MULTISAMPLE_6_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_7_SAMPLES     ]  = DIS_MULTISAMPLE_7_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_8_SAMPLES     ]  = DIS_MULTISAMPLE_8_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_9_SAMPLES     ]  = DIS_MULTISAMPLE_9_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_10_SAMPLES    ]  = DIS_MULTISAMPLE_10_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_11_SAMPLES    ]  = DIS_MULTISAMPLE_11_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_12_SAMPLES    ]  = DIS_MULTISAMPLE_12_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_13_SAMPLES    ]  = DIS_MULTISAMPLE_13_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_14_SAMPLES    ]  = DIS_MULTISAMPLE_14_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_15_SAMPLES    ]  = DIS_MULTISAMPLE_15_SAMPLES;
	D3DtoDIS_MultiSampleType[ D3DMULTISAMPLE_16_SAMPLES    ]  = DIS_MULTISAMPLE_16_SAMPLES;
	
	D3DtoDIS_PatchEdgeStyle[ D3DPATCHEDGE_DISCRETE   ] = DIS_PATCHEDGE_DISCRETE;
	D3DtoDIS_PatchEdgeStyle[ D3DPATCHEDGE_CONTINUOUS ] = DIS_PATCHEDGE_CONTINUOUS;

	D3DtoDIS_Pool[ D3DPOOL_DEFAULT      ]= DIS_POOL_DEFAULT;
	D3DtoDIS_Pool[ D3DPOOL_MANAGED      ]= DIS_POOL_MANAGED;
	D3DtoDIS_Pool[ D3DPOOL_SYSTEMMEM    ]= DIS_POOL_SYSTEMMEM;
	D3DtoDIS_Pool[ D3DPOOL_SCRATCH      ]= DIS_POOL_SCRATCH;

	D3DtoDIS_PrimitiveType[ D3DPT_POINTLIST      ]  = DIS_PT_POINTLIST;
	D3DtoDIS_PrimitiveType[ D3DPT_LINELIST       ]  = DIS_PT_LINELIST;
	D3DtoDIS_PrimitiveType[ D3DPT_LINESTRIP      ]  = DIS_PT_LINESTRIP;
	D3DtoDIS_PrimitiveType[ D3DPT_TRIANGLELIST   ]  = DIS_PT_TRIANGLELIST;
	D3DtoDIS_PrimitiveType[ D3DPT_TRIANGLESTRIP  ]  = DIS_PT_TRIANGLESTRIP;
	D3DtoDIS_PrimitiveType[ D3DPT_TRIANGLEFAN    ]  = DIS_PT_TRIANGLEFAN;

	D3DtoDIS_QueryType[ D3DQUERYTYPE_VCACHE             ]  = DIS_QUERYTYPE_VCACHE;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_RESOURCEMANAGER    ]  = DIS_QUERYTYPE_RESOURCEMANAGER;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_VERTEXSTATS        ]  = DIS_QUERYTYPE_VERTEXSTATS;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_EVENT              ]  = DIS_QUERYTYPE_EVENT;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_OCCLUSION          ]  = DIS_QUERYTYPE_OCCLUSION;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_TIMESTAMP          ]  = DIS_QUERYTYPE_TIMESTAMP;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_TIMESTAMPDISJOINT  ]  = DIS_QUERYTYPE_TIMESTAMPDISJOINT;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_TIMESTAMPFREQ      ]  = DIS_QUERYTYPE_TIMESTAMPFREQ;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_PIPELINETIMINGS    ]  = DIS_QUERYTYPE_PIPELINETIMINGS;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_INTERFACETIMINGS   ]  = DIS_QUERYTYPE_INTERFACETIMINGS;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_VERTEXTIMINGS      ]  = DIS_QUERYTYPE_VERTEXTIMINGS;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_PIXELTIMINGS       ]  = DIS_QUERYTYPE_PIXELTIMINGS;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_BANDWIDTHTIMINGS   ]  = DIS_QUERYTYPE_BANDWIDTHTIMINGS;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_CACHEUTILIZATION   ]  = DIS_QUERYTYPE_CACHEUTILIZATION;
	D3DtoDIS_QueryType[ D3DQUERYTYPE_MEMORYPRESSURE     ] = DIS_QUERYTYPE_MEMORYPRESSURE;

	D3DtoDIS_RenderstateType[ D3DRS_ZENABLE                     ]  = DISRS_ZENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_FILLMODE                    ]  = DISRS_FILLMODE;
	D3DtoDIS_RenderstateType[ D3DRS_SHADEMODE                   ]  = DISRS_SHADEMODE;
	D3DtoDIS_RenderstateType[ D3DRS_ZWRITEENABLE                ]  = DISRS_ZWRITEENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_ALPHATESTENABLE             ]  = DISRS_ALPHATESTENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_LASTPIXEL                   ]  = DISRS_LASTPIXEL;
	D3DtoDIS_RenderstateType[ D3DRS_SRCBLEND                    ]  = DISRS_SRCBLEND;
	D3DtoDIS_RenderstateType[ D3DRS_DESTBLEND                   ]  = DISRS_DESTBLEND;
	D3DtoDIS_RenderstateType[ D3DRS_CULLMODE                    ]  = DISRS_CULLMODE;
	D3DtoDIS_RenderstateType[ D3DRS_ZFUNC                       ]  = DISRS_ZFUNC;
	D3DtoDIS_RenderstateType[ D3DRS_ALPHAREF                    ]  = DISRS_ALPHAREF;
	D3DtoDIS_RenderstateType[ D3DRS_ALPHAFUNC                   ]  = DISRS_ALPHAFUNC;
	D3DtoDIS_RenderstateType[ D3DRS_DITHERENABLE                ]  = DISRS_DITHERENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_ALPHABLENDENABLE            ]  = DISRS_ALPHABLENDENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_FOGENABLE                   ]  = DISRS_FOGENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_SPECULARENABLE              ]  = DISRS_SPECULARENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_FOGCOLOR                    ]  = DISRS_FOGCOLOR;
	D3DtoDIS_RenderstateType[ D3DRS_FOGTABLEMODE                ]  = DISRS_FOGTABLEMODE;
	D3DtoDIS_RenderstateType[ D3DRS_FOGSTART                    ]  = DISRS_FOGSTART;
	D3DtoDIS_RenderstateType[ D3DRS_FOGEND                      ]  = DISRS_FOGEND;
	D3DtoDIS_RenderstateType[ D3DRS_FOGDENSITY                  ]  = DISRS_FOGDENSITY;
	D3DtoDIS_RenderstateType[ D3DRS_RANGEFOGENABLE              ]  = DISRS_RANGEFOGENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_STENCILENABLE               ]  = DISRS_STENCILENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_STENCILFAIL                 ]  = DISRS_STENCILFAIL;
	D3DtoDIS_RenderstateType[ D3DRS_STENCILZFAIL                ]  = DISRS_STENCILZFAIL;
	D3DtoDIS_RenderstateType[ D3DRS_STENCILPASS                 ]  = DISRS_STENCILPASS;
	D3DtoDIS_RenderstateType[ D3DRS_STENCILFUNC                 ]  = DISRS_STENCILFUNC;
	D3DtoDIS_RenderstateType[ D3DRS_STENCILREF                  ]  = DISRS_STENCILREF;
	D3DtoDIS_RenderstateType[ D3DRS_STENCILMASK                 ]  = DISRS_STENCILMASK;
	D3DtoDIS_RenderstateType[ D3DRS_STENCILWRITEMASK            ]  = DISRS_STENCILWRITEMASK;
	D3DtoDIS_RenderstateType[ D3DRS_TEXTUREFACTOR               ]  = DISRS_TEXTUREFACTOR;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP0                       ]  = DISRS_WRAP0;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP1                       ]  = DISRS_WRAP1;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP2                       ]  = DISRS_WRAP2;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP3                       ]  = DISRS_WRAP3;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP4                       ]  = DISRS_WRAP4;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP5                       ]  = DISRS_WRAP5;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP6                       ]  = DISRS_WRAP6;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP7                       ]  = DISRS_WRAP7;
	D3DtoDIS_RenderstateType[ D3DRS_CLIPPING                    ]  = DISRS_CLIPPING;
	D3DtoDIS_RenderstateType[ D3DRS_LIGHTING                    ]  = DISRS_LIGHTING;
	D3DtoDIS_RenderstateType[ D3DRS_AMBIENT                     ]  = DISRS_AMBIENT;
	D3DtoDIS_RenderstateType[ D3DRS_FOGVERTEXMODE               ]  = DISRS_FOGVERTEXMODE;
	D3DtoDIS_RenderstateType[ D3DRS_COLORVERTEX                 ]  = DISRS_COLORVERTEX;
	D3DtoDIS_RenderstateType[ D3DRS_LOCALVIEWER                 ]  = DISRS_LOCALVIEWER;
	D3DtoDIS_RenderstateType[ D3DRS_NORMALIZENORMALS            ]  = DISRS_NORMALIZENORMALS;
	D3DtoDIS_RenderstateType[ D3DRS_DIFFUSEMATERIALSOURCE       ]  = DISRS_DIFFUSEMATERIALSOURCE;
	D3DtoDIS_RenderstateType[ D3DRS_SPECULARMATERIALSOURCE      ]  = DISRS_SPECULARMATERIALSOURCE;
	D3DtoDIS_RenderstateType[ D3DRS_AMBIENTMATERIALSOURCE       ]  = DISRS_AMBIENTMATERIALSOURCE;
	D3DtoDIS_RenderstateType[ D3DRS_EMISSIVEMATERIALSOURCE      ]  = DISRS_EMISSIVEMATERIALSOURCE;
	D3DtoDIS_RenderstateType[ D3DRS_VERTEXBLEND                 ]  = DISRS_VERTEXBLEND;
	D3DtoDIS_RenderstateType[ D3DRS_CLIPPLANEENABLE             ]  = DISRS_CLIPPLANEENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_POINTSIZE                   ]  = DISRS_POINTSIZE;
	D3DtoDIS_RenderstateType[ D3DRS_POINTSIZE_MIN               ]  = DISRS_POINTSIZE_MIN;
	D3DtoDIS_RenderstateType[ D3DRS_POINTSPRITEENABLE           ]  = DISRS_POINTSPRITEENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_POINTSCALEENABLE            ]  = DISRS_POINTSCALEENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_POINTSCALE_A                ]  = DISRS_POINTSCALE_A;
	D3DtoDIS_RenderstateType[ D3DRS_POINTSCALE_B                ]  = DISRS_POINTSCALE_B;
	D3DtoDIS_RenderstateType[ D3DRS_POINTSCALE_C                ]  = DISRS_POINTSCALE_C;
	D3DtoDIS_RenderstateType[ D3DRS_MULTISAMPLEANTIALIAS        ]  = DISRS_MULTISAMPLEANTIALIAS;
	D3DtoDIS_RenderstateType[ D3DRS_MULTISAMPLEMASK             ]  = DISRS_MULTISAMPLEMASK;
	D3DtoDIS_RenderstateType[ D3DRS_PATCHEDGESTYLE              ]  = DISRS_PATCHEDGESTYLE;
	D3DtoDIS_RenderstateType[ D3DRS_DEBUGMONITORTOKEN           ]  = DISRS_DEBUGMONITORTOKEN;
	D3DtoDIS_RenderstateType[ D3DRS_POINTSIZE_MAX               ]  = DISRS_POINTSIZE_MAX;
	D3DtoDIS_RenderstateType[ D3DRS_INDEXEDVERTEXBLENDENABLE    ]  = DISRS_INDEXEDVERTEXBLENDENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_COLORWRITEENABLE            ]  = DISRS_COLORWRITEENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_TWEENFACTOR                 ]  = DISRS_TWEENFACTOR;
	D3DtoDIS_RenderstateType[ D3DRS_BLENDOP                     ]  = DISRS_BLENDOP;
	D3DtoDIS_RenderstateType[ D3DRS_POSITIONDEGREE              ]  = DISRS_POSITIONDEGREE;
	D3DtoDIS_RenderstateType[ D3DRS_NORMALDEGREE                ]  = DISRS_NORMALDEGREE;
	D3DtoDIS_RenderstateType[ D3DRS_SCISSORTESTENABLE           ]  = DISRS_SCISSORTESTENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_SLOPESCALEDEPTHBIAS         ]  = DISRS_SLOPESCALEDEPTHBIAS;
	D3DtoDIS_RenderstateType[ D3DRS_ANTIALIASEDLINEENABLE       ]  = DISRS_ANTIALIASEDLINEENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_MINTESSELLATIONLEVEL        ]  = DISRS_MINTESSELLATIONLEVEL;
	D3DtoDIS_RenderstateType[ D3DRS_MAXTESSELLATIONLEVEL        ]  = DISRS_MAXTESSELLATIONLEVEL;
	D3DtoDIS_RenderstateType[ D3DRS_ADAPTIVETESS_X              ]  = DISRS_ADAPTIVETESS_X;
	D3DtoDIS_RenderstateType[ D3DRS_ADAPTIVETESS_Y              ]  = DISRS_ADAPTIVETESS_Y;
	D3DtoDIS_RenderstateType[ D3DRS_ADAPTIVETESS_Z              ]  = DISRS_ADAPTIVETESS_Z;
	D3DtoDIS_RenderstateType[ D3DRS_ADAPTIVETESS_W              ]  = DISRS_ADAPTIVETESS_W;
	D3DtoDIS_RenderstateType[ D3DRS_ENABLEADAPTIVETESSELLATION  ]  = DISRS_ENABLEADAPTIVETESSELLATION;
	D3DtoDIS_RenderstateType[ D3DRS_TWOSIDEDSTENCILMODE         ]  = DISRS_TWOSIDEDSTENCILMODE;
	D3DtoDIS_RenderstateType[ D3DRS_CCW_STENCILFAIL             ]  = DISRS_CCW_STENCILFAIL;
	D3DtoDIS_RenderstateType[ D3DRS_CCW_STENCILZFAIL            ]  = DISRS_CCW_STENCILZFAIL;
	D3DtoDIS_RenderstateType[ D3DRS_CCW_STENCILPASS             ]  = DISRS_CCW_STENCILPASS;
	D3DtoDIS_RenderstateType[ D3DRS_CCW_STENCILFUNC             ]  = DISRS_CCW_STENCILFUNC;
	D3DtoDIS_RenderstateType[ D3DRS_COLORWRITEENABLE1           ]  = DISRS_COLORWRITEENABLE1;
	D3DtoDIS_RenderstateType[ D3DRS_COLORWRITEENABLE2           ]  = DISRS_COLORWRITEENABLE2;
	D3DtoDIS_RenderstateType[ D3DRS_COLORWRITEENABLE3           ]  = DISRS_COLORWRITEENABLE3;
	D3DtoDIS_RenderstateType[ D3DRS_BLENDFACTOR                 ]  = DISRS_BLENDFACTOR;
	D3DtoDIS_RenderstateType[ D3DRS_SRGBWRITEENABLE             ]  = DISRS_SRGBWRITEENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_DEPTHBIAS                   ]  = DISRS_DEPTHBIAS;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP8                       ]  = DISRS_WRAP8;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP9                       ]  = DISRS_WRAP9;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP10                      ]  = DISRS_WRAP10;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP11                      ]  = DISRS_WRAP11;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP12                      ]  = DISRS_WRAP12;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP13                      ]  = DISRS_WRAP13;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP14                      ]  = DISRS_WRAP14;
	D3DtoDIS_RenderstateType[ D3DRS_WRAP15                      ]  = DISRS_WRAP15;
	D3DtoDIS_RenderstateType[ D3DRS_SEPARATEALPHABLENDENABLE    ]  = DISRS_SEPARATEALPHABLENDENABLE;
	D3DtoDIS_RenderstateType[ D3DRS_SRCBLENDALPHA               ]  = DISRS_SRCBLENDALPHA;
	D3DtoDIS_RenderstateType[ D3DRS_DESTBLENDALPHA              ]  = DISRS_DESTBLENDALPHA;
	D3DtoDIS_RenderstateType[ D3DRS_BLENDOPALPHA                ]  = DISRS_BLENDOPALPHA;

	D3DtoDIS_ResourceType[ D3DRTYPE_SURFACE        ] = DIS_RTYPE_SURFACE;
	D3DtoDIS_ResourceType[ D3DRTYPE_VOLUME         ] = DIS_RTYPE_VOLUME;
	D3DtoDIS_ResourceType[ D3DRTYPE_TEXTURE        ] = DIS_RTYPE_TEXTURE;
	D3DtoDIS_ResourceType[ D3DRTYPE_VOLUMETEXTURE  ] = DIS_RTYPE_VOLUMETEXTURE;
	D3DtoDIS_ResourceType[ D3DRTYPE_CUBETEXTURE    ] = DIS_RTYPE_CUBETEXTURE;
	D3DtoDIS_ResourceType[ D3DRTYPE_VERTEXBUFFER   ] = DIS_RTYPE_VERTEXBUFFER;
	D3DtoDIS_ResourceType[ D3DRTYPE_INDEXBUFFER    ] = DIS_RTYPE_INDEXBUFFER;


/*	D3DtoDIS_SamplerTextureType[ D3DSTT_UNKNOWN        ] = DIS_STT_UNKNOWN;
	D3DtoDIS_SamplerTextureType[ D3DSTT_2D         ] = DIS_STT_2D;
	D3DtoDIS_SamplerTextureType[ D3DSTT_CUBE        ] = DIS_STT_CUBE;
	D3DtoDIS_SamplerTextureType[ D3DSTT_VOLUME  ] = DIS_STT_VOLUME;
	*/

	D3DtoDIS_SamplerStateType[ D3DSAMP_ADDRESSU       ] = DIS_SAMP_ADDRESSU;
	D3DtoDIS_SamplerStateType[ D3DSAMP_ADDRESSV       ] = DIS_SAMP_ADDRESSV;
	D3DtoDIS_SamplerStateType[ D3DSAMP_ADDRESSW       ] = DIS_SAMP_ADDRESSW;
	D3DtoDIS_SamplerStateType[ D3DSAMP_BORDERCOLOR    ] = DIS_SAMP_BORDERCOLOR;
	D3DtoDIS_SamplerStateType[ D3DSAMP_MAGFILTER      ] = DIS_SAMP_MAGFILTER;
	D3DtoDIS_SamplerStateType[ D3DSAMP_MINFILTER      ] = DIS_SAMP_MINFILTER;
	D3DtoDIS_SamplerStateType[ D3DSAMP_MIPFILTER      ] = DIS_SAMP_MIPFILTER;
	D3DtoDIS_SamplerStateType[ D3DSAMP_MIPMAPLODBIAS  ] = DIS_SAMP_MIPMAPLODBIAS;
	D3DtoDIS_SamplerStateType[ D3DSAMP_MAXMIPLEVEL    ] = DIS_SAMP_MAXMIPLEVEL;
	D3DtoDIS_SamplerStateType[ D3DSAMP_MAXANISOTROPY  ] = DIS_SAMP_MAXANISOTROPY;
	D3DtoDIS_SamplerStateType[ D3DSAMP_SRGBTEXTURE    ] = DIS_SAMP_SRGBTEXTURE;
	D3DtoDIS_SamplerStateType[ D3DSAMP_ELEMENTINDEX   ] = DIS_SAMP_ELEMENTINDEX;
	D3DtoDIS_SamplerStateType[ D3DSAMP_DMAPOFFSET     ] = DIS_SAMP_DMAPOFFSET;

	D3DtoDIS_ScanlineOrdering[D3DSCANLINEORDERING_PROGRESSIVE]  = DIS_SCANLINEORDERING_PROGRESSIVE;
	D3DtoDIS_ScanlineOrdering[D3DSCANLINEORDERING_INTERLACED]   = DIS_SCANLINEORDERING_INTERLACED;
	
	D3DtoDIS_ShadeMode[D3DSHADE_FLAT]         = DIS_SHADE_FLAT;
	D3DtoDIS_ShadeMode[D3DSHADE_GOURAUD]      = DIS_SHADE_GOURAUD;
	D3DtoDIS_ShadeMode[D3DSHADE_PHONG]        = DIS_SHADE_PHONG;

	D3DtoDIS_StateBlockType[D3DSBT_ALL]         = DIS_SBT_ALL;
	D3DtoDIS_StateBlockType[D3DSBT_PIXELSTATE]      = DIS_SBT_PIXELSTATE;
	D3DtoDIS_StateBlockType[D3DSBT_VERTEXSTATE]        = DIS_SBT_VERTEXSTATE;

	D3DtoDIS_StencilOp[ D3DSTENCILOP_KEEP         ] = DIS_STENCILOP_KEEP;
	D3DtoDIS_StencilOp[ D3DSTENCILOP_ZERO         ] = DIS_STENCILOP_ZERO;
	D3DtoDIS_StencilOp[ D3DSTENCILOP_REPLACE      ] = DIS_STENCILOP_REPLACE;
	D3DtoDIS_StencilOp[ D3DSTENCILOP_INCRSAT      ] = DIS_STENCILOP_INCRSAT;
	D3DtoDIS_StencilOp[ D3DSTENCILOP_DECRSAT      ] = DIS_STENCILOP_DECRSAT;
	D3DtoDIS_StencilOp[ D3DSTENCILOP_INVERT       ] = DIS_STENCILOP_INVERT;
	D3DtoDIS_StencilOp[ D3DSTENCILOP_INCR         ] = DIS_STENCILOP_INCR;
	D3DtoDIS_StencilOp[ D3DSTENCILOP_DECR         ] = DIS_STENCILOP_DECR;

  
	D3DtoDIS_SwapEffect[ D3DSWAPEFFECT_DISCARD      ] = DIS_SWAPEFFECT_DISCARD;
	D3DtoDIS_SwapEffect[ D3DSWAPEFFECT_FLIP      ] = DIS_SWAPEFFECT_FLIP;
	D3DtoDIS_SwapEffect[ D3DSWAPEFFECT_COPY       ] = DIS_SWAPEFFECT_COPY;
	D3DtoDIS_SwapEffect[ D3DSWAPEFFECT_OVERLAY         ] = DIS_SWAPEFFECT_OVERLAY;
	D3DtoDIS_SwapEffect[ D3DSWAPEFFECT_FLIPEX         ] = DIS_SWAPEFFECT_FLIPEX;



	D3DtoDIS_TextureAddress[ D3DTADDRESS_WRAP      ] = DIS_TADDRESS_WRAP;
	D3DtoDIS_TextureAddress[ D3DTADDRESS_MIRROR      ] = DIS_TADDRESS_MIRROR;
	D3DtoDIS_TextureAddress[ D3DTADDRESS_CLAMP       ] = DIS_TADDRESS_CLAMP;
	D3DtoDIS_TextureAddress[ D3DTADDRESS_BORDER         ] = DIS_TADDRESS_BORDER;
	D3DtoDIS_TextureAddress[ D3DTADDRESS_MIRRORONCE         ] = DIS_TADDRESS_MIRRORONCE;

	D3DtoDIS_TextureFilterType[ D3DTEXF_NONE             ] = DIS_TEXF_NONE;
	D3DtoDIS_TextureFilterType[ D3DTEXF_POINT            ] = DIS_TEXF_POINT;
	D3DtoDIS_TextureFilterType[ D3DTEXF_LINEAR           ] = DIS_TEXF_LINEAR;
	D3DtoDIS_TextureFilterType[ D3DTEXF_ANISOTROPIC      ] = DIS_TEXF_ANISOTROPIC;
	D3DtoDIS_TextureFilterType[ D3DTEXF_PYRAMIDALQUAD    ] = DIS_TEXF_PYRAMIDALQUAD;
	D3DtoDIS_TextureFilterType[ D3DTEXF_GAUSSIANQUAD     ] = DIS_TEXF_GAUSSIANQUAD;
	D3DtoDIS_TextureFilterType[ D3DTEXF_CONVOLUTIONMONO  ] = DIS_TEXF_CONVOLUTIONMONO;

	D3DtoDIS_TextureOp[ D3DTOP_DISABLE                    ] = DIS_TOP_DISABLE;
	D3DtoDIS_TextureOp[ D3DTOP_SELECTARG1                 ] = DIS_TOP_SELECTARG1;
	D3DtoDIS_TextureOp[ D3DTOP_SELECTARG2                 ] = DIS_TOP_SELECTARG2;
	D3DtoDIS_TextureOp[ D3DTOP_MODULATE                   ] = DIS_TOP_MODULATE;
	D3DtoDIS_TextureOp[ D3DTOP_MODULATE2X                 ] = DIS_TOP_MODULATE2X;
	D3DtoDIS_TextureOp[ D3DTOP_MODULATE4X                 ] = DIS_TOP_MODULATE4X;
	D3DtoDIS_TextureOp[ D3DTOP_ADD                        ] = DIS_TOP_ADD;
	D3DtoDIS_TextureOp[ D3DTOP_ADDSIGNED                  ] = DIS_TOP_ADDSIGNED;
	D3DtoDIS_TextureOp[ D3DTOP_ADDSIGNED2X                ] = DIS_TOP_ADDSIGNED2X;
	D3DtoDIS_TextureOp[ D3DTOP_SUBTRACT                   ] = DIS_TOP_SUBTRACT;
	D3DtoDIS_TextureOp[ D3DTOP_ADDSMOOTH                  ] = DIS_TOP_ADDSMOOTH;
	D3DtoDIS_TextureOp[ D3DTOP_BLENDDIFFUSEALPHA          ] = DIS_TOP_BLENDDIFFUSEALPHA;
	D3DtoDIS_TextureOp[ D3DTOP_BLENDTEXTUREALPHA          ] = DIS_TOP_BLENDTEXTUREALPHA;
	D3DtoDIS_TextureOp[ D3DTOP_BLENDFACTORALPHA           ] = DIS_TOP_BLENDFACTORALPHA;
	D3DtoDIS_TextureOp[ D3DTOP_BLENDTEXTUREALPHAPM        ] = DIS_TOP_BLENDTEXTUREALPHAPM;
	D3DtoDIS_TextureOp[ D3DTOP_BLENDCURRENTALPHA          ] = DIS_TOP_BLENDCURRENTALPHA;
	D3DtoDIS_TextureOp[ D3DTOP_PREMODULATE                ] = DIS_TOP_PREMODULATE;
	D3DtoDIS_TextureOp[ D3DTOP_MODULATEALPHA_ADDCOLOR     ] = DIS_TOP_MODULATEALPHA_ADDCOLOR;
	D3DtoDIS_TextureOp[ D3DTOP_MODULATECOLOR_ADDALPHA     ] = DIS_TOP_MODULATECOLOR_ADDALPHA;
	D3DtoDIS_TextureOp[ D3DTOP_MODULATEINVALPHA_ADDCOLOR  ] = DIS_TOP_MODULATEINVALPHA_ADDCOLOR;
	D3DtoDIS_TextureOp[ D3DTOP_MODULATEINVCOLOR_ADDALPHA  ] = DIS_TOP_MODULATEINVCOLOR_ADDALPHA;
	D3DtoDIS_TextureOp[ D3DTOP_BUMPENVMAP                 ] = DIS_TOP_BUMPENVMAP;
	D3DtoDIS_TextureOp[ D3DTOP_BUMPENVMAPLUMINANCE        ] = DIS_TOP_BUMPENVMAPLUMINANCE;
	D3DtoDIS_TextureOp[ D3DTOP_DOTPRODUCT3                ] = DIS_TOP_DOTPRODUCT3;
	D3DtoDIS_TextureOp[ D3DTOP_MULTIPLYADD                ] = DIS_TOP_MULTIPLYADD;
	D3DtoDIS_TextureOp[ D3DTOP_LERP                       ] = DIS_TOP_LERP;

	D3DtoDIS_TextureStageStateType[ D3DTSS_COLOROP                ] = DIS_TSS_COLOROP;
	D3DtoDIS_TextureStageStateType[ D3DTSS_COLORARG1              ] = DIS_TSS_COLORARG1;
	D3DtoDIS_TextureStageStateType[ D3DTSS_COLORARG2              ] = DIS_TSS_COLORARG2;
	D3DtoDIS_TextureStageStateType[ D3DTSS_ALPHAOP                ] = DIS_TSS_ALPHAOP;
	D3DtoDIS_TextureStageStateType[ D3DTSS_ALPHAARG1              ] = DIS_TSS_ALPHAARG1;
	D3DtoDIS_TextureStageStateType[ D3DTSS_ALPHAARG2              ] = DIS_TSS_ALPHAARG2;
	D3DtoDIS_TextureStageStateType[ D3DTSS_BUMPENVMAT00           ] = DIS_TSS_BUMPENVMAT00;
	D3DtoDIS_TextureStageStateType[ D3DTSS_BUMPENVMAT01           ] = DIS_TSS_BUMPENVMAT01;
	D3DtoDIS_TextureStageStateType[ D3DTSS_BUMPENVMAT10           ] = DIS_TSS_BUMPENVMAT10;
	D3DtoDIS_TextureStageStateType[ D3DTSS_BUMPENVMAT11           ] = DIS_TSS_BUMPENVMAT11;
	D3DtoDIS_TextureStageStateType[ D3DTSS_TEXCOORDINDEX          ] = DIS_TSS_TEXCOORDINDEX;
	D3DtoDIS_TextureStageStateType[ D3DTSS_BUMPENVLSCALE          ] = DIS_TSS_BUMPENVLSCALE;
	D3DtoDIS_TextureStageStateType[ D3DTSS_BUMPENVLOFFSET         ] = DIS_TSS_BUMPENVLOFFSET;
	D3DtoDIS_TextureStageStateType[ D3DTSS_TEXTURETRANSFORMFLAGS  ] = DIS_TSS_TEXTURETRANSFORMFLAGS;
	D3DtoDIS_TextureStageStateType[ D3DTSS_COLORARG0              ] = DIS_TSS_COLORARG0;
	D3DtoDIS_TextureStageStateType[ D3DTSS_ALPHAARG0              ] = DIS_TSS_ALPHAARG0;
	D3DtoDIS_TextureStageStateType[ D3DTSS_RESULTARG              ] = DIS_TSS_RESULTARG;
	D3DtoDIS_TextureStageStateType[ D3DTSS_CONSTANT               ] = DIS_TSS_CONSTANT;

	D3DtoDIS_TextureTransformFlags[ D3DTTFF_DISABLE      ]= DIS_TTFF_DISABLE;
	D3DtoDIS_TextureTransformFlags[ D3DTTFF_COUNT1       ]= DIS_TTFF_COUNT1;
	D3DtoDIS_TextureTransformFlags[ D3DTTFF_COUNT2       ]= DIS_TTFF_COUNT2;
	D3DtoDIS_TextureTransformFlags[ D3DTTFF_COUNT3       ]= DIS_TTFF_COUNT3;
	D3DtoDIS_TextureTransformFlags[ D3DTTFF_COUNT4       ]= DIS_TTFF_COUNT4;
	D3DtoDIS_TextureTransformFlags[ D3DTTFF_PROJECTED    ]= DIS_TTFF_PROJECTED;
	
	D3DtoDIS_TransformStateType[ D3DTS_VIEW         ] = DIS_TS_VIEW;
	D3DtoDIS_TransformStateType[ D3DTS_PROJECTION   ] = DIS_TS_PROJECTION;
	D3DtoDIS_TransformStateType[ D3DTS_TEXTURE0     ] = DIS_TS_TEXTURE0;
	D3DtoDIS_TransformStateType[ D3DTS_TEXTURE1     ] = DIS_TS_TEXTURE1;
	D3DtoDIS_TransformStateType[ D3DTS_TEXTURE2     ] = DIS_TS_TEXTURE2;
	D3DtoDIS_TransformStateType[ D3DTS_TEXTURE3     ] = DIS_TS_TEXTURE3;
	D3DtoDIS_TransformStateType[ D3DTS_TEXTURE4     ] = DIS_TS_TEXTURE4;
	D3DtoDIS_TransformStateType[ D3DTS_TEXTURE5     ] = DIS_TS_TEXTURE5;
	D3DtoDIS_TransformStateType[ D3DTS_TEXTURE6     ] = DIS_TS_TEXTURE6;
	D3DtoDIS_TransformStateType[ D3DTS_TEXTURE7     ] = DIS_TS_TEXTURE7;

	D3DtoDIS_VertexBlendFlags[ D3DVBF_DISABLE     ] = DIS_VBF_DISABLE;
	D3DtoDIS_VertexBlendFlags[ D3DVBF_1WEIGHTS     ] = DIS_VBF_1WEIGHTS;
	D3DtoDIS_VertexBlendFlags[ D3DVBF_2WEIGHTS     ] = DIS_VBF_2WEIGHTS;
	D3DtoDIS_VertexBlendFlags[ D3DVBF_3WEIGHTS     ] = DIS_VBF_3WEIGHTS;
	D3DtoDIS_VertexBlendFlags[ D3DVBF_TWEENING     ] = DIS_VBF_TWEENING;
	D3DtoDIS_VertexBlendFlags[ D3DVBF_0WEIGHTS     ] = DIS_VBF_0WEIGHTS;

	D3DtoDIS_ZBufferType[D3DZB_FALSE        ]= DIS_ZB_FALSE;
	D3DtoDIS_ZBufferType[D3DZB_TRUE         ]= DIS_ZB_TRUE;
	D3DtoDIS_ZBufferType[D3DZB_USEW         ]= DIS_ZB_USEW;

}

DIS_D3DConversion::~DIS_D3DConversion()
{
}



DIS_BACKBUFFER_TYPE DIS_D3DConversion::BackBufferType( D3DBACKBUFFER_TYPE  t )
{
	return this->D3DtoDIS_BackBuffer[ t ];
	/*switch(t)
	{
	case D3DBACKBUFFER_TYPE_MONO: return DIS_BACKBUFFER_TYPE_MONO;
	case D3DBACKBUFFER_TYPE_LEFT : return DIS_BACKBUFFER_TYPE_LEFT;
	case D3DBACKBUFFER_TYPE_RIGHT: return DIS_BACKBUFFER_TYPE_RIGHT;
	default:
		return DIS_BACKBUFFER_TYPE_MONO;
	};*/
}

DIS_BASISTYPE DIS_D3DConversion::BasisType( D3DBASISTYPE t )
{
	return this->D3DtoDIS_BasisType[ t ];
	/*switch(t)
	{
	case D3DBASIS_BEZIER: return DIS_BASIS_BEZIER;
	case D3DBASIS_BSPLINE: return DIS_BASIS_BSPLINE;
	case D3DBASIS_CATMULL_ROM: return DIS_BASIS_CATMULL_ROM;
	default:
		return DIS_BASIS_BEZIER;
	};*/
}

DIS_BLEND DIS_D3DConversion::BlendType( D3DBLEND t )
{
	return this->D3DtoDIS_BlendType[ t ];
	/*switch(t)
	{
	case D3DBLEND_ZERO: return DIS_BLEND_ZERO;
	case D3DBLEND_ONE:	return DIS_BLEND_ONE;
	case D3DBLEND_SRCCOLOR:	return DIS_BLEND_SRCCOLOR;
	case D3DBLEND_INVSRCCOLOR:	return DIS_BLEND_INVSRCCOLOR;
	case D3DBLEND_SRCALPHA:	return DIS_BLEND_SRCALPHA;
	case D3DBLEND_INVSRCALPHA:	return DIS_BLEND_INVSRCALPHA;
	case D3DBLEND_DESTALPHA:	return DIS_BLEND_DESTALPHA;
	case D3DBLEND_INVDESTALPHA:	return DIS_BLEND_INVDESTALPHA;
	case D3DBLEND_DESTCOLOR:	return DIS_BLEND_DESTCOLOR;
	case D3DBLEND_INVDESTCOLOR:	return DIS_BLEND_INVDESTCOLOR;
	case D3DBLEND_SRCALPHASAT:	return DIS_BLEND_SRCALPHASAT;
	case D3DBLEND_BOTHSRCALPHA:	return DIS_BLEND_BOTHSRCALPHA;
	case D3DBLEND_BOTHINVSRCALPHA:	return DIS_BLEND_BOTHINVSRCALPHA;
	case D3DBLEND_BLENDFACTOR:	return DIS_BLEND_BLENDFACTOR;
	case D3DBLEND_INVBLENDFACTOR:	return DIS_BLEND_INVBLENDFACTOR;
	case D3DBLEND_SRCCOLOR2:	return DIS_BLEND_SRCCOLOR2;
	case D3DBLEND_INVSRCCOLOR2:	return DIS_BLEND_INVSRCCOLOR2;
	default: return DIS_BLEND_ZERO;
	};*/
}
DIS_BLENDOP DIS_D3DConversion::BlendOp( D3DBLENDOP t )
{
	return this->D3DtoDIS_BlendOp[ t ];
	/*switch(t)
	{
	case D3DBLENDOP_ADD: return DIS_BLENDOP_ADD;
	case D3DBLENDOP_SUBTRACT: return DIS_BLENDOP_SUBTRACT;
	case D3DBLENDOP_REVSUBTRACT: return DIS_BLENDOP_REVSUBTRACT;
	case D3DBLENDOP_MIN: return DIS_BLENDOP_MIN;
	case D3DBLENDOP_MAX: return DIS_BLENDOP_MAX;
	default: return DIS_BLENDOP_ADD;
	}*/
}

DIS_CMPFUNC DIS_D3DConversion::CompareFunc( D3DCMPFUNC t )
{
	return this->D3DtoDIS_CmpFunc[ t ];
	/*switch(t)
	{
	case D3DCMP_NEVER: return DIS_CMP_NEVER;
	case D3DCMP_LESS: return DIS_CMP_LESS;
	case D3DCMP_EQUAL: return DIS_CMP_EQUAL;
	case D3DCMP_LESSEQUAL: return DIS_CMP_LESSEQUAL;
	case D3DCMP_GREATER: return DIS_CMP_GREATER;
	case D3DCMP_NOTEQUAL: return DIS_CMP_NOTEQUAL;
	case D3DCMP_GREATEREQUAL: return DIS_CMP_GREATEREQUAL;
	case D3DCMP_ALWAYS: return DIS_CMP_ALWAYS;
	default: return DIS_CMP_NEVER;
	}*/
}

DIS_COMPOSERECTSOP DIS_D3DConversion::ComposerOp( D3DCOMPOSERECTSOP t )
{
	return this->D3DtoDIS_ComposerOp[ t ];
	/*switch(t)
	{
	case D3DCOMPOSERECTS_COPY: return DIS_COMPOSERECTS_COPY;
	case D3DCOMPOSERECTS_OR: return DIS_COMPOSERECTS_OR;
	case D3DCOMPOSERECTS_AND: return DIS_COMPOSERECTS_AND;
	case D3DCOMPOSERECTS_NEG : return DIS_COMPOSERECTS_NEG;

	default: return DIS_COMPOSERECTS_COPY;
	}*/
}

DIS_CUBEMAP_FACES DIS_D3DConversion::CubemapFace( D3DCUBEMAP_FACES t )
{
	return this->D3DtoDIS_CubemapFaces[ t ];
	/*switch(t)
	{
	case D3DCUBEMAP_FACE_POSITIVE_X: return DIS_CUBEMAP_FACE_POSITIVE_X;
	case D3DCUBEMAP_FACE_NEGATIVE_X: return DIS_CUBEMAP_FACE_NEGATIVE_X;
	case D3DCUBEMAP_FACE_POSITIVE_Y: return DIS_CUBEMAP_FACE_POSITIVE_Y;
	case D3DCUBEMAP_FACE_NEGATIVE_Y : return DIS_CUBEMAP_FACE_NEGATIVE_Y;
	case D3DCUBEMAP_FACE_POSITIVE_Z: return DIS_CUBEMAP_FACE_POSITIVE_Z;
	case D3DCUBEMAP_FACE_NEGATIVE_Z : return DIS_CUBEMAP_FACE_NEGATIVE_Z;
	default: return DIS_CUBEMAP_FACE_POSITIVE_X;
	}*/
}

DIS_CULL DIS_D3DConversion::CullMode( D3DCULL t )
{
	return this->D3DtoDIS_CullMode[ t ];
	/*switch(t)
	{
	case D3DCULL_NONE: return DIS_CULL_NONE;
	case D3DCULL_CW: return DIS_CULL_CW;
	case D3DCULL_CCW: return DIS_CULL_CCW;

	default: return DIS_CULL_NONE;
	}*/
}

DIS_DEBUGMONITORTOKENS DIS_D3DConversion::DebugMonitorToken( D3DDEBUGMONITORTOKENS t )
{
	return this->D3DtoDIS_DebugMonitorTokens[ t ];
	/*if( t == D3DDMT_ENABLE )
		return DIS_DMT_ENABLE;
	else return DIS_DMT_DISABLE;*/
}

DIS_DECLMETHOD DIS_D3DConversion::DeclMethod( D3DDECLMETHOD t )
{
	return this->D3DtoDIS_DeclMethod[ t ];
	/*switch(t)
	{
	case D3DDECLMETHOD_DEFAULT: return DIS_DECLMETHOD_DEFAULT;
	case D3DDECLMETHOD_PARTIALU: return DIS_DECLMETHOD_PARTIALU;
	case D3DDECLMETHOD_PARTIALV: return DIS_DECLMETHOD_PARTIALV;
	case D3DDECLMETHOD_CROSSUV: return DIS_DECLMETHOD_CROSSUV;
	case D3DDECLMETHOD_UV: return DIS_DECLMETHOD_UV;
	case D3DDECLMETHOD_LOOKUP: return DIS_DECLMETHOD_LOOKUP;
	case D3DDECLMETHOD_LOOKUPPRESAMPLED: return DIS_DECLMETHOD_LOOKUPPRESAMPLED;
	default: return DIS_DECLMETHOD_DEFAULT;
	}
	*/
}

DIS_DECLTYPE DIS_D3DConversion::DeclType( D3DDECLTYPE t )
{
	return this->D3DtoDIS_DeclType[ t ];
	/*switch(t)
	{
	case D3DDECLTYPE_FLOAT1: return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_FLOAT2  :return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_FLOAT3:return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_FLOAT4:return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_D3DCOLOR :return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_UBYTE4:return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_SHORT2:return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_SHORT4:return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_UBYTE4N :return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_SHORT2N:return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_SHORT4N :return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_USHORT2N :return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_USHORT4N:return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_UDEC3:return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_DEC3N:return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_FLOAT16_2:return DIS_DECLTYPE_FLOAT1;
	case D3DDECLTYPE_FLOAT16_4:return DIS_DECLTYPE_FLOAT1;
	case  D3DDECLTYPE_UNUSED :return DIS_DECLTYPE_FLOAT1;
	default: return DIS_DECLTYPE_FLOAT1;
	}*/
}


DIS_DECLUSAGE DIS_D3DConversion::DeclUsage( D3DDECLUSAGE t )
{
	return this->D3DtoDIS_DeclUsage[ t ];
	/*switch(t)
	{ 
	case D3DDECLUSAGE_POSITION: return DIS_DECLUSAGE_POSITION      ;// 0,
	case D3DDECLUSAGE_BLENDWEIGHT: return DIS_DECLUSAGE_BLENDWEIGHT   ;// 1,
	case D3DDECLUSAGE_BLENDINDICES: return DIS_DECLUSAGE_BLENDINDICES  ;// 2,
	case D3DDECLUSAGE_NORMAL: return DIS_DECLUSAGE_NORMAL        ;// 3,
	case D3DDECLUSAGE_PSIZE: return DIS_DECLUSAGE_PSIZE;// 4,
	case D3DDECLUSAGE_TEXCOORD: return DIS_DECLUSAGE_TEXCOORD      ;// 5,
	case D3DDECLUSAGE_TANGENT: return DIS_DECLUSAGE_TANGENT       ;// 6,
	case D3DDECLUSAGE_BINORMAL: return DIS_DECLUSAGE_BINORMAL      ;// 7,
	case D3DDECLUSAGE_TESSFACTOR: return DIS_DECLUSAGE_TESSFACTOR    ;// 8,
	case D3DDECLUSAGE_POSITIONT: return DIS_DECLUSAGE_POSITIONT     ;// 9,
	case D3DDECLUSAGE_COLOR: return DIS_DECLUSAGE_COLOR         ;// 10,
	case D3DDECLUSAGE_FOG: return DIS_DECLUSAGE_FOG           ;// 11,
	case D3DDECLUSAGE_DEPTH: return DIS_DECLUSAGE_DEPTH         ;// 12,
	case D3DDECLUSAGE_SAMPLE: return DIS_DECLUSAGE_SAMPLE        ;// 13
	default: return DIS_DECLUSAGE_POSITION;
	}*/
}
DIS_DEGREETYPE DIS_D3DConversion::DegreeType( D3DDEGREETYPE t )
{
	return this->D3DtoDIS_DegreeType[ t ];
	/*switch(t)
	{
	case D3DDEGREE_LINEAR : return DIS_DEGREE_LINEAR     ;// 1,
	case D3DDEGREE_QUADRATIC : return DIS_DEGREE_QUADRATIC  ;// 2,
	case D3DDEGREE_CUBIC : return DIS_DEGREE_CUBIC      ;// 3,
	case D3DDEGREE_QUINTIC : return DIS_DEGREE_QUINTIC    ;// 4,
	default: return DIS_DEGREE_LINEAR;
	}*/
}

DIS_DEVTYPE DIS_D3DConversion::DeviceType( D3DDEVTYPE t )
{
	return this->D3DtoDIS_DevType[ t ];
	/*switch(t)
	{
	case D3DDEVTYPE_HAL : return DIS_DEVTYPE_HAL;// 1,
	case D3DDEVTYPE_NULLREF : return DIS_DEVTYPE_NULLREF;// 2,
	case D3DDEVTYPE_REF    : return DIS_DEVTYPE_REF;// 3,
	case D3DDEVTYPE_SW : return DIS_DEVTYPE_SW;// 4,
	default: return DIS_DEVTYPE_HAL;
	}*/
}	

DIS_DISPLAYROTATION DIS_D3DConversion::DisplayRotation( D3DDISPLAYROTATION t )
{
	return this->D3DtoDIS_DisplayRotation[ t ];
	/*switch(t)
	{
	case D3DDISPLAYROTATION_IDENTITY:return DIS_DISPLAYROTATION_IDENTITY  ;// 1,
	case D3DDISPLAYROTATION_90:return DIS_DISPLAYROTATION_90        ;// 2,
	case D3DDISPLAYROTATION_180:return DIS_DISPLAYROTATION_180       ;// 3,
	case D3DDISPLAYROTATION_270:return DIS_DISPLAYROTATION_270       ;// 4
	default: return DIS_DISPLAYROTATION_IDENTITY;
	}*/
}

UInt32 DIS_D3DConversion::FillMode( D3DFILLMODE t )
{
	UInt32 retValue = 0;
	if( t & D3DFILL_SOLID )
	{
		retValue |= DIS_FILL_SOLID;
	}
	if( t & D3DFILL_WIREFRAME )
	{
		retValue |= DIS_FILL_WIREFRAME;
	}
	if( t & D3DFILL_POINT )
	{
		retValue |= DIS_FILL_POINT;
	}
	return retValue;
	//return this->D3DtoDIS_FillMode[ t ];
	/*switch(t)
	{
	case D3DFILL_SOLID : return DIS_FILL_SOLID;// 0,
	case D3DFILL_POINT :return DIS_FILL_POINT       ;// 1,
	case D3DFILL_WIREFRAME :return DIS_FILL_WIREFRAME   ;// 2,
//	case (D3DFILL_SOLID & D3DFILL_POINT): return DIS_FILL_SOLID & DIS_FILL_POINT);
//	case (D3DFILL_SOLID & D3DFILL_WIREFRAME): return DIS_FILL_SOLID & DIS_FILL_WIREFRAME);
//	case (D3DFILL_POINT & D3DFILL_WIREFRAME): return DIS_FILL_POINT & DIS_FILL_WIREFRAME);
//	case (D3DFILL_SOLID & D3DFILL_POINT  & D3DFILL_WIREFRAME): return DIS_FILL_SOLID & D3DFILL_POINT  & DIS_FILL_WIREFRAME);
	default :return DIS_FILL_SOLID      ;// 3,
	}*/
}

DIS_FOGMODE DIS_D3DConversion::FogMode( D3DFOGMODE t )
{
	return this->D3DtoDIS_FogMode[ t ];
	/*switch(t)
	{
	case D3DFOG_NONE : return DIS_FOG_NONE;// 0,
	case D3DFOG_EXP  :return DIS_FOG_EXP;// 1,
	case D3DFOG_EXP2 :return DIS_FOG_EXP2;// 2,
	case D3DFOG_LINEAR :return DIS_FOG_LINEAR;// 2,
	default :return DIS_FOG_NONE;// 3,
	}*/
}

DIS_FORMAT DIS_D3DConversion::dFormat( D3DFORMAT t )
{
	// need to switch here because MAKE_FOURCC 
	// returns a big number and a sparse table
	// for these values is completely impractical
	switch(t)
	{
	case D3DFMT_UYVY: return DIS_FMT_UYVY;
	case D3DFMT_R8G8_B8G8: return DIS_FMT_R8G8_B8G8;
	case D3DFMT_YUY2: return DIS_FMT_YUY2;
	case D3DFMT_G8R8_G8B8: return DIS_FMT_G8R8_G8B8;
	case D3DFMT_DXT1:return DIS_FMT_DXT1;
	case D3DFMT_DXT2: return DIS_FMT_DXT2;
	case D3DFMT_DXT3: return DIS_FMT_DXT3;
	case D3DFMT_DXT4: return DIS_FMT_DXT4;
	case D3DFMT_DXT5: return DIS_FMT_DXT5;
	case D3DFMT_MULTI2_ARGB8: return DIS_FMT_MULTI2_ARGB8;
	default: return this->D3DtoDIS_Format[ t ];
	};
	
	/*switch(t)
	{
    case D3DFMT_UNKNOWN: return DIS_FMT_UNKNOWN              ;////  0;//
    case D3DFMT_R8G8B8: return DIS_FMT_R8G8B8               ;//// 20;//
    case D3DFMT_A8R8G8B8: return DIS_FMT_A8R8G8B8             ;//// 21;//
    case D3DFMT_X8R8G8B8: return DIS_FMT_X8R8G8B8             ;//// 22;//
    case D3DFMT_R5G6B5: return DIS_FMT_R5G6B5               ;//// 23;//
    case D3DFMT_X1R5G5B5: return DIS_FMT_X1R5G5B5             ;//// 24;//
    case D3DFMT_A1R5G5B5: return DIS_FMT_A1R5G5B5             ;//// 25;//
    case D3DFMT_A4R4G4B4: return DIS_FMT_A4R4G4B4             ;//// 26;//
   case D3DFMT_R3G3B2: return DIS_FMT_R3G3B2               ;//// 27;//
    case D3DFMT_A8:D3DFMT_A8                   ;//// 28;//
    case D3DFMT_A8R3G3B2: return DIS_FMT_A8R3G3B2             ;//// 29;//
    case D3DFMT_X4R4G4B4: return DIS_FMT_X4R4G4B4             ;//// 30;//
    case D3DFMT_A2B10G10R10: return DIS_FMT_A2B10G10R10          ;//// 31;//
    case D3DFMT_A8B8G8R8: return DIS_FMT_A8B8G8R8             ;//// 32;//
    case D3DFMT_X8B8G8R8: return DIS_FMT_X8B8G8R8             ;//// 33;//
    case D3DFMT_G16R16: return DIS_FMT_G16R16               ;//// 34;//
    case D3DFMT_A2R10G10B10: return DIS_FMT_A2R10G10B10          ;//// 35;//
    case D3DFMT_A16B16G16R16: return DIS_FMT_A16B16G16R16         ;//// 36;//
    case D3DFMT_A8P8: return DIS_FMT_A8P8                 ;//// 40;//
    case D3DFMT_P8: return DIS_FMT_P8                   ;//// 41;//
    case D3DFMT_L8: return DIS_FMT_L8                   ;//// 50;//
    case D3DFMT_A8L8: return DIS_FMT_A8L8                 ;//// 51;//
    case D3DFMT_A4L4: return DIS_FMT_A4L4                 ;//// 52;//
    case D3DFMT_V8U8: return DIS_FMT_V8U8                 ;//// 60;//
    case D3DFMT_L6V5U5: return DIS_FMT_L6V5U5               ;//// 61;//
    case D3DFMT_X8L8V8U8: return DIS_FMT_X8L8V8U8             ;//// 62;//
    case D3DFMT_Q8W8V8U8: return DIS_FMT_Q8W8V8U8             ;//// 63;//
    case D3DFMT_V16U16: return DIS_FMT_V16U16               ;//// 64;//
    case D3DFMT_A2W10V10U10: return DIS_FMT_A2W10V10U10          ;//// 67;//
    case D3DFMT_UYVY: return DIS_FMT_UYVY                 ;//// MAKEFOURCC('U';// 'Y';// 'V';// 'Y');//
    case D3DFMT_R8G8_B8G8: return DIS_FMT_R8G8_B8G8            ;//// MAKEFOURCC('R';// 'G';// 'B';// 'G');//
    case D3DFMT_YUY2: return DIS_FMT_YUY2                 ;//// MAKEFOURCC('Y';// 'U';// 'Y';// '2');//
    case D3DFMT_G8R8_G8B8: return DIS_FMT_G8R8_G8B8            ;//// MAKEFOURCC('G';// 'R';// 'G';// 'B');//
    case D3DFMT_DXT1: return DIS_FMT_DXT1                 ;//// MAKEFOURCC('D';// 'X';// 'T';// '1');//
    case D3DFMT_DXT2: return DIS_FMT_DXT2                 ;//// MAKEFOURCC('D';// 'X';// 'T';// '2');//
    case D3DFMT_DXT3: return DIS_FMT_DXT3                 ;//// MAKEFOURCC('D';// 'X';// 'T';// '3');//
    case D3DFMT_DXT4: return DIS_FMT_DXT4                 ;//// MAKEFOURCC('D';// 'X';// 'T';// '4');//
    case D3DFMT_DXT5: return DIS_FMT_DXT5                 ;//// MAKEFOURCC('D';// 'X';// 'T';// '5');//
    case D3DFMT_D16_LOCKABLE: return DIS_FMT_D16_LOCKABLE         ;//// 70;//
    case D3DFMT_D32: return DIS_FMT_D32                  ;//// 71;//
    case D3DFMT_D15S1: return DIS_FMT_D15S1                ;//// 73;//
    case D3DFMT_D24S8: return DIS_FMT_D24S8                ;//// 75;//
    case D3DFMT_D24X8: return DIS_FMT_D24X8                ;//// 77;//
    case D3DFMT_D24X4S4: return DIS_FMT_D24X4S4              ;//// 79;//
    case D3DFMT_D16: return DIS_FMT_D16                  ;//// 80;//
    case D3DFMT_D32F_LOCKABLE: return DIS_FMT_D32F_LOCKABLE        ;//// 82;//
    case D3DFMT_D24FS8: return DIS_FMT_D24FS8               ;//// 83;//
    case D3DFMT_L16: return DIS_FMT_L16                  ;//// 81;//
    case D3DFMT_VERTEXDATA: return DIS_FMT_VERTEXDATA           ;////100;//
    case D3DFMT_INDEX16: return DIS_FMT_INDEX16              ;////101;//
    case D3DFMT_INDEX32: return DIS_FMT_INDEX32              ;////102;//
    case D3DFMT_Q16W16V16U16: return DIS_FMT_Q16W16V16U16         ;////110;//
    case D3DFMT_MULTI2_ARGB8: return DIS_FMT_MULTI2_ARGB8         ;//// MAKEFOURCC('M';//'E';//'T';//'1');//
    case D3DFMT_R16F: return DIS_FMT_R16F                 ;//// 111;//
    case D3DFMT_G16R16F: return DIS_FMT_G16R16F              ;//// 112;//
    case D3DFMT_A16B16G16R16F: return DIS_FMT_A16B16G16R16F        ;//// 113;//
    case D3DFMT_R32F: return DIS_FMT_R32F                 ;//// 114;//
    case D3DFMT_G32R32F: return DIS_FMT_G32R32F              ;//// 115;//
    case D3DFMT_A32B32G32R32F: return DIS_FMT_A32B32G32R32F        ;//// 116;//
    case D3DFMT_CxV8U8: return DIS_FMT_CxV8U8               ;//// 117;//
//#if !defined(DIS_Format[: return DIS__DISABLE_9EX)
    case D3DFMT_D32_LOCKABLE: return DIS_FMT_D32_LOCKABLE         ;//// 84;//
    case D3DFMT_S8_LOCKABLE: return DIS_FMT_S8_LOCKABLE          ;//// 85;//
    case D3DFMT_A1: return DIS_FMT_A1                   ;//// 118;//
    case D3DFMT_A2B10G10R10_XR_BIAS: return DIS_FMT_A2B10G10R10_XR_BIAS  ;//// 119;//
    case D3DFMT_BINARYBUFFER: return DIS_FMT_BINARYBUFFER         ;//// 199;//
	default: return DIS_FMT_UNKNOWN;
	}*/
}

DIS_LIGHTTYPE DIS_D3DConversion::LightType( D3DLIGHTTYPE t )
{
	return this->D3DtoDIS_LightType[ t ];
	/*switch(t)
	{

	case D3DLIGHT_POINT:return DIS_LIGHT_POINT        ;// 1,
	case D3DLIGHT_SPOT:return DIS_LIGHT_SPOT         ;// 2,
	case D3DLIGHT_DIRECTIONAL:return DIS_LIGHT_DIRECTIONAL  ;// 3,
	default: return DIS_LIGHT_POINT;
	}*/
}

DIS_MATERIALCOLORSOURCE DIS_D3DConversion::MaterialColorSource( D3DMATERIALCOLORSOURCE t )
{
	return this->D3DtoDIS_MaterialColorSource[ t ];
	/*switch(t)
	{
	case D3DMCS_MATERIAL: return DIS_MCS_MATERIAL;//     = 0,
	case D3DMCS_COLOR1: return DIS_MCS_COLOR1;//       = 1,
	case D3DMCS_COLOR2: return DIS_MCS_COLOR2;//       = 2,
	default: return DIS_MCS_MATERIAL;
	}*/
}
	
DIS_MULTISAMPLE_TYPE DIS_D3DConversion::MultiSampleType( D3DMULTISAMPLE_TYPE t )
{
	return this->D3DtoDIS_MultiSampleType[ t ];
	/*switch(t)
	{
	case D3DMULTISAMPLE_NONE: return DIS_MULTISAMPLE_NONE          ;// 0,
	case D3DMULTISAMPLE_NONMASKABLE: return DIS_MULTISAMPLE_NONMASKABLE   ;// 1,
	case D3DMULTISAMPLE_2_SAMPLES: return DIS_MULTISAMPLE_2_SAMPLES     ;// 2,
	case D3DMULTISAMPLE_3_SAMPLES: return DIS_MULTISAMPLE_3_SAMPLES     ;// 3,
	case D3DMULTISAMPLE_4_SAMPLES:return DIS_MULTISAMPLE_4_SAMPLES     ;// 4,
	case D3DMULTISAMPLE_5_SAMPLES:return DIS_MULTISAMPLE_5_SAMPLES     ;// 5,
	case D3DMULTISAMPLE_6_SAMPLES:return DIS_MULTISAMPLE_6_SAMPLES     ;// 6,
	case D3DMULTISAMPLE_7_SAMPLES:return DIS_MULTISAMPLE_7_SAMPLES     ;// 7,
	case D3DMULTISAMPLE_8_SAMPLES:return DIS_MULTISAMPLE_8_SAMPLES     ;// 8,
	case D3DMULTISAMPLE_9_SAMPLES: return DIS_MULTISAMPLE_9_SAMPLES     ;// 9,
	case D3DMULTISAMPLE_10_SAMPLES:return DIS_MULTISAMPLE_10_SAMPLES    ;// 10,
	case D3DMULTISAMPLE_11_SAMPLES:return DIS_MULTISAMPLE_11_SAMPLES    ;// 11,
	case D3DMULTISAMPLE_12_SAMPLES:return DIS_MULTISAMPLE_12_SAMPLES    ;// 12,
	case D3DMULTISAMPLE_13_SAMPLES:return DIS_MULTISAMPLE_13_SAMPLES    ;// 13,
	case D3DMULTISAMPLE_14_SAMPLES:return DIS_MULTISAMPLE_14_SAMPLES    ;// 14,
	case D3DMULTISAMPLE_15_SAMPLES:return DIS_MULTISAMPLE_15_SAMPLES    ;// 15,
	case D3DMULTISAMPLE_16_SAMPLES: return DIS_MULTISAMPLE_16_SAMPLES    ;// 16,
	default:D3DMULTISAMPLE_NONE;
	}*/
}

DIS_PATCHEDGESTYLE DIS_D3DConversion::PatchEdgeStyle( D3DPATCHEDGESTYLE t )
{
	return this->D3DtoDIS_PatchEdgeStyle[ t ];
	/*switch(t)
	{
	case D3DPATCHEDGE_DISCRETE:return DIS_PATCHEDGE_DISCRETE;//     = 0,
	case D3DPATCHEDGE_CONTINUOUS:return DIS_PATCHEDGE_CONTINUOUS;//   = 1,
	default: return DIS_PATCHEDGE_DISCRETE;
	}*/
};


DIS_POOL DIS_D3DConversion::dPool( D3DPOOL t )
{
	return this->D3DtoDIS_Pool[ t ];
	/*switch(t)
	{
	case D3DPOOL_DEFAULT: return DIS_POOL_DEFAULT;//      = 0,
	case D3DPOOL_MANAGED: return DIS_POOL_MANAGED;//      = 1,
	case D3DPOOL_SYSTEMMEM:return DIS_POOL_SYSTEMMEM;//    = 2,
	case D3DPOOL_SCRATCH: return DIS_POOL_SCRATCH; //     = 3,
	default: return DIS_POOL_DEFAULT;
	}*/
}

DIS_PRIMITIVETYPE DIS_D3DConversion::dPrimitiveType( D3DPRIMITIVETYPE t )
{
	return this->D3DtoDIS_PrimitiveType[ t ];
	/*switch(t)
	{
	case D3DPT_POINTLIST : return DIS_PT_POINTLIST      ;// 1,
	case D3DPT_LINELIST       :return DIS_PT_LINELIST       ;// 2,
	case D3DPT_LINESTRIP: return DIS_PT_LINESTRIP      ;// 3,
	case D3DPT_TRIANGLELIST: return DIS_PT_TRIANGLELIST   ;// 4,
	case D3DPT_TRIANGLESTRIP: return DIS_PT_TRIANGLESTRIP  ;// 5,
	case D3DPT_TRIANGLEFAN: return DIS_PT_TRIANGLEFAN    ;// 6,
	default: return DIS_PT_TRIANGLELIST;
	}
	*/
}


DIS_QUERYTYPE DIS_D3DConversion::dQueryType( D3DQUERYTYPE t )
{
	return this->D3DtoDIS_QueryType[ t ];
	/*switch(t)
	{
	case D3DQUERYTYPE_VCACHE: return DIS_QUERYTYPE_VCACHE             ;// 1,
	case D3DQUERYTYPE_RESOURCEMANAGER:return DIS_QUERYTYPE_RESOURCEMANAGER    ;// 2,
	case D3DQUERYTYPE_VERTEXSTATS:return DIS_QUERYTYPE_VERTEXSTATS        ;// 3,
	case D3DQUERYTYPE_EVENT:return DIS_QUERYTYPE_EVENT              ;// 4,
	case D3DQUERYTYPE_OCCLUSION: return DIS_QUERYTYPE_OCCLUSION          ;// 5,
	case D3DQUERYTYPE_TIMESTAMP: return DIS_QUERYTYPE_TIMESTAMP          ;// 6,
	case D3DQUERYTYPE_TIMESTAMPDISJOINT: return DIS_QUERYTYPE_TIMESTAMPDISJOINT  ;// 7,
	case D3DQUERYTYPE_TIMESTAMPFREQ: return DIS_QUERYTYPE_TIMESTAMPFREQ      ;// 8,
	case D3DQUERYTYPE_PIPELINETIMINGS: return DIS_QUERYTYPE_PIPELINETIMINGS    ;// 9,
	case D3DQUERYTYPE_INTERFACETIMINGS: return DIS_QUERYTYPE_INTERFACETIMINGS   ;// 10,
	case D3DQUERYTYPE_VERTEXTIMINGS: return DIS_QUERYTYPE_VERTEXTIMINGS      ;// 11,
	case D3DQUERYTYPE_PIXELTIMINGS: return DIS_QUERYTYPE_PIXELTIMINGS       ;// 12,
	case D3DQUERYTYPE_BANDWIDTHTIMINGS: return DIS_QUERYTYPE_BANDWIDTHTIMINGS   ;// 13,
	case D3DQUERYTYPE_CACHEUTILIZATION: return DIS_QUERYTYPE_CACHEUTILIZATION   ;// 14,
	case D3DQUERYTYPE_MEMORYPRESSURE: return DIS_QUERYTYPE_MEMORYPRESSURE     ;// 15	
	default: return DIS_QUERYTYPE_VCACHE;
	}*/
}

DIS_RENDERSTATETYPE DIS_D3DConversion::RenderState( D3DRENDERSTATETYPE t )
{
	return this->D3DtoDIS_RenderstateType[ t ];
	/*switch(t)
	{
	case  D3DRS_ZENABLE: return DISRS_ZENABLE                     ;//// 7;//
	case  D3DRS_FILLMODE: return DISRS_FILLMODE                    ;//// 8;//
	case  D3DRS_SHADEMODE: return DISRS_SHADEMODE                   ;//// 9;//
	case  D3DRS_ZWRITEENABLE: return DISRS_ZWRITEENABLE                ;//// 14;//
	case  D3DRS_ALPHATESTENABLE: return DISRS_ALPHATESTENABLE             ;//// 15;//
	case  D3DRS_LASTPIXEL: return DISRS_LASTPIXEL                   ;//// 16;//
	case  D3DRS_SRCBLEND: return DISRS_SRCBLEND                    ;//// 19;//
	case  D3DRS_DESTBLEND: return DISRS_DESTBLEND                   ;//// 20;//
	case  D3DRS_CULLMODE: return DISRS_CULLMODE                    ;//// 22;//
	case  D3DRS_ZFUNC: return DISRS_ZFUNC                       ;//// 23;//
	case  D3DRS_ALPHAREF: return DISRS_ALPHAREF                    ;//// 24;//
	case  D3DRS_ALPHAFUNC: return DISRS_ALPHAFUNC                   ;//// 25;//
	case  D3DRS_DITHERENABLE: return DISRS_DITHERENABLE                ;//// 26;//
	case  D3DRS_ALPHABLENDENABLE: return DISRS_ALPHABLENDENABLE            ;//// 27;//
	case  D3DRS_FOGENABLE: return DISRS_FOGENABLE                   ;//// 28;//
	case  D3DRS_SPECULARENABLE: return DISRS_SPECULARENABLE              ;//// 29;//
	case  D3DRS_FOGCOLOR: return DISRS_FOGCOLOR                    ;//// 34;//
	case  D3DRS_FOGTABLEMODE: return DISRS_FOGTABLEMODE                ;//// 35;//
	case  D3DRS_FOGSTART: return DISRS_FOGSTART                    ;//// 36;//
	case  D3DRS_FOGEND: return DISRS_FOGEND                      ;//// 37;//
	case D3DRS_FOGDENSITY : return DISRS_FOGDENSITY                  ;//// 38;//
	case  D3DRS_RANGEFOGENABLE: return DISRS_RANGEFOGENABLE              ;//// 48;//
	case  D3DRS_STENCILENABLE: return DISRS_STENCILENABLE               ;//// 52;//
	case  D3DRS_STENCILFAIL: return DISRS_STENCILFAIL                 ;//// 53;//
	case  D3DRS_STENCILZFAIL: return DISRS_STENCILZFAIL                ;//// 54;//
	case  D3DRS_STENCILPASS: return DISRS_STENCILPASS                 ;//// 55;//
	case  D3DRS_STENCILFUNC: return DISRS_STENCILFUNC                 ;//// 56;//
	case  D3DRS_STENCILREF: return DISRS_STENCILREF                  ;//// 57;//
	case  D3DRS_STENCILMASK: return DISRS_STENCILMASK                 ;//// 58;//
	case  D3DRS_STENCILWRITEMASK: return DISRS_STENCILWRITEMASK            ;//// 59;//
	case D3DRS_TEXTUREFACTOR : return DISRS_TEXTUREFACTOR               ;//// 60;//
	case  D3DRS_WRAP0: return DISRS_WRAP0                       ;//// 128;//
	case  D3DRS_WRAP1: return DISRS_WRAP1                       ;//// 129;//
	case  D3DRS_WRAP2: return DISRS_WRAP2                       ;//// 130;//
	case  D3DRS_WRAP3: return DISRS_WRAP3                       ;//// 131;//
	case  D3DRS_WRAP4: return DISRS_WRAP4                       ;//// 132;//
	case  D3DRS_WRAP5: return DISRS_WRAP5                       ;//// 133;//
	case  D3DRS_WRAP6: return DISRS_WRAP6                       ;//// 134;//
	case  D3DRS_WRAP7: return DISRS_WRAP7                       ;//// 135;//
	case  D3DRS_CLIPPING: return DISRS_CLIPPING                    ;//// 136;//
	case D3DRS_LIGHTING: return DISRS_LIGHTING                    ;//// 137;//
	case  D3DRS_AMBIENT: return DISRS_AMBIENT                     ;//// 139;//
	case  D3DRS_FOGVERTEXMODE: return DISRS_FOGVERTEXMODE               ;//// 140;//
	case  D3DRS_COLORVERTEX: return DISRS_COLORVERTEX                 ;//// 141;//
	case  D3DRS_LOCALVIEWER: return DISRS_LOCALVIEWER                 ;//// 142;//
	case  D3DRS_NORMALIZENORMALS: return DISRS_NORMALIZENORMALS            ;//// 143;//
	case  D3DRS_DIFFUSEMATERIALSOURCE: return DISRS_DIFFUSEMATERIALSOURCE       ;//// 145;//
	case  D3DRS_SPECULARMATERIALSOURCE: return DISRS_SPECULARMATERIALSOURCE      ;//// 146;//
	case  D3DRS_AMBIENTMATERIALSOURCE: return DISRS_AMBIENTMATERIALSOURCE       ;//// 147;//
	case  D3DRS_EMISSIVEMATERIALSOURCE: return DISRS_EMISSIVEMATERIALSOURCE      ;//// 148;//
	case D3DRS_VERTEXBLEND : return DISRS_VERTEXBLEND                 ;//// 151;//
	case  D3DRS_CLIPPLANEENABLE: return DISRS_CLIPPLANEENABLE             ;//// 152;//
	case  D3DRS_POINTSIZE: return DISRS_POINTSIZE                   ;//// 154;//
	case  D3DRS_POINTSIZE_MIN: return DISRS_POINTSIZE_MIN               ;//// 155;//
	case  D3DRS_POINTSPRITEENABLE: return DISRS_POINTSPRITEENABLE           ;//// 156;//
	case  D3DRS_POINTSCALEENABLE: return DISRS_POINTSCALEENABLE            ;//// 157;//
	case  D3DRS_POINTSCALE_A: return DISRS_POINTSCALE_A                ;//// 158;//
	case  D3DRS_POINTSCALE_B: return DISRS_POINTSCALE_B                ;//// 159;//
	case  D3DRS_POINTSCALE_C: return DISRS_POINTSCALE_C                ;//// 160;//
	case  D3DRS_MULTISAMPLEANTIALIAS: return DISRS_MULTISAMPLEANTIALIAS        ;//// 161;//
	case D3DRS_MULTISAMPLEMASK : return DISRS_MULTISAMPLEMASK             ;//// 162;//
	case  D3DRS_PATCHEDGESTYLE: return DISRS_PATCHEDGESTYLE              ;//// 163;//
	case  D3DRS_DEBUGMONITORTOKEN: return DISRS_DEBUGMONITORTOKEN           ;//// 165;//
	case  D3DRS_POINTSIZE_MAX: return DISRS_POINTSIZE_MAX               ;//// 166;//
	case  D3DRS_INDEXEDVERTEXBLENDENABLE: return DISRS_INDEXEDVERTEXBLENDENABLE    ;//// 167;//
	case  D3DRS_COLORWRITEENABLE: return DISRS_COLORWRITEENABLE            ;//// 168;//
	case  D3DRS_TWEENFACTOR: return DISRS_TWEENFACTOR                 ;//// 170;//
	case  D3DRS_BLENDOP: return DISRS_BLENDOP                     ;//// 171;//
	case  D3DRS_POSITIONDEGREE: return DISRS_POSITIONDEGREE              ;//// 172;//
	case  D3DRS_NORMALDEGREE: return DISRS_NORMALDEGREE                ;//// 173;//
	case D3DRS_SCISSORTESTENABLE : return DISRS_SCISSORTESTENABLE           ;//// 174;//
	case  D3DRS_SLOPESCALEDEPTHBIAS: return DISRS_SLOPESCALEDEPTHBIAS         ;//// 175;//
	case  D3DRS_ANTIALIASEDLINEENABLE: return DISRS_ANTIALIASEDLINEENABLE       ;//// 176;//
	case  D3DRS_MINTESSELLATIONLEVEL: return DISRS_MINTESSELLATIONLEVEL        ;//// 178;//
	case  D3DRS_MAXTESSELLATIONLEVEL: return DISRS_MAXTESSELLATIONLEVEL        ;//// 179;//
	case  D3DRS_ADAPTIVETESS_X: return DISRS_ADAPTIVETESS_X              ;//// 180;//
	case  D3DRS_ADAPTIVETESS_Y: return DISRS_ADAPTIVETESS_Y              ;//// 181;//
	case  D3DRS_ADAPTIVETESS_Z: return DISRS_ADAPTIVETESS_Z              ;//// 182;//
	case  D3DRS_ADAPTIVETESS_W: return DISRS_ADAPTIVETESS_W              ;//// 183;//
	case  D3DRS_ENABLEADAPTIVETESSELLATION: return DISRS_ENABLEADAPTIVETESSELLATION  ;//// 184;//
	case D3DRS_TWOSIDEDSTENCILMODE : return DISRS_TWOSIDEDSTENCILMODE         ;//// 185;//
	case  D3DRS_CCW_STENCILFAIL: return DISRS_CCW_STENCILFAIL             ;//// 186;//
	case  D3DRS_CCW_STENCILZFAIL: return DISRS_CCW_STENCILZFAIL            ;//// 187;//
	case  D3DRS_CCW_STENCILPASS: return DISRS_CCW_STENCILPASS             ;//// 188;//
	case  D3DRS_CCW_STENCILFUNC: return DISRS_CCW_STENCILFUNC             ;//// 189;//
	case  D3DRS_COLORWRITEENABLE1: return DISRS_COLORWRITEENABLE1           ;//// 190;//
	case  D3DRS_COLORWRITEENABLE2: return DISRS_COLORWRITEENABLE2           ;//// 191;//
	case  D3DRS_COLORWRITEENABLE3: return DISRS_COLORWRITEENABLE3           ;//// 192;//
	case  D3DRS_BLENDFACTOR: return DISRS_BLENDFACTOR                 ;//// 193;//
	case  D3DRS_SRGBWRITEENABLE: return DISRS_SRGBWRITEENABLE             ;//// 194;//
	case D3DRS_DEPTHBIAS: return DISRS_DEPTHBIAS                   ;//// 195;//
	case  D3DRS_WRAP8: return DISRS_WRAP8                       ;//// 198;//
	case  D3DRS_WRAP9: return DISRS_WRAP9                       ;//// 199;//
	case  D3DRS_WRAP10: return DISRS_WRAP10                      ;//// 200;//
	case  D3DRS_WRAP11: return DISRS_WRAP11                      ;//// 201;//
	case  D3DRS_WRAP12: return DISRS_WRAP12                      ;//// 202;//
	case  D3DRS_WRAP13: return DISRS_WRAP13                      ;//// 203;//
	case  D3DRS_WRAP14: return DISRS_WRAP14                      ;//// 204;//
	case  D3DRS_WRAP15: return DISRS_WRAP15                      ;//// 205;//
	case  D3DRS_SEPARATEALPHABLENDENABLE: return DISRS_SEPARATEALPHABLENDENABLE    ;//// 206;//
	case D3DRS_SRCBLENDALPHA: return DISRS_SRCBLENDALPHA               ;//// 207;//
	case D3DRS_DESTBLENDALPHA: return DISRS_DESTBLENDALPHA              ;//// 208;//
	case D3DRS_BLENDOPALPHA : return DISRS_BLENDOPALPHA                ;//// 209;//
	default: return DISRS_BLENDOPALPHA;
	}
	*/
}


DIS_RESOURCETYPE DIS_D3DConversion::ResourceType( D3DRESOURCETYPE t )
{
	return this->D3DtoDIS_ResourceType[ t ];
	/*switch(t)
	{
	case D3DRTYPE_SURFACE : return DIS_RTYPE_SURFACE;//        = 0,
	case D3DRTYPE_VOLUME: return DIS_RTYPE_VOLUME ;//        = 1,
	case D3DRTYPE_TEXTURE: return DIS_RTYPE_TEXTURE;//        = 2,
	case D3DRTYPE_VOLUMETEXTURE: return DIS_RTYPE_VOLUMETEXTURE;//  = 3,
	case D3DRTYPE_CUBETEXTURE: return DIS_RTYPE_CUBETEXTURE;//    = 4,
	case D3DRTYPE_VERTEXBUFFER: return DIS_RTYPE_VERTEXBUFFER;//   = 5,
	case D3DRTYPE_INDEXBUFFER: return DIS_RTYPE_INDEXBUFFER;//    = 6,
	}*/
}

DIS_SAMPLER_TEXTURE_TYPE DIS_D3DConversion::SampleTextureType( D3DSAMPLER_TEXTURE_TYPE t )
{
	//return this->D3DtoDIS_SamplerTextureType[ t ];
	switch(t)
	{
	case D3DSTT_UNKNOWN: return DIS_STT_UNKNOWN;
	case D3DSTT_2D: return DIS_STT_2D;
	case D3DSTT_CUBE: return DIS_STT_CUBE;
	case D3DSTT_VOLUME: return DIS_STT_VOLUME;
	default: return DIS_STT_UNKNOWN;
	}
}

DIS_SAMPLERSTATETYPE DIS_D3DConversion::SampleStateType( D3DSAMPLERSTATETYPE t )
{
	return this->D3DtoDIS_SamplerStateType[ t ];
	/*switch(t)
	{
	case D3DSAMP_ADDRESSU: return DIS_SAMP_ADDRESSU       ;// 1,
	case D3DSAMP_ADDRESSV: return DIS_SAMP_ADDRESSV       ;// 2,
	case D3DSAMP_ADDRESSW: return DIS_SAMP_ADDRESSW       ;// 3,
	case D3DSAMP_BORDERCOLOR: return DIS_SAMP_BORDERCOLOR    ;// 4,
	case D3DSAMP_MAGFILTER: return DIS_SAMP_MAGFILTER      ;// 5,
	case D3DSAMP_MINFILTER: return DIS_SAMP_MINFILTER      ;// 6,
	case D3DSAMP_MIPFILTER: return DIS_SAMP_MIPFILTER      ;// 7,
	case D3DSAMP_MIPMAPLODBIAS: return DIS_SAMP_MIPMAPLODBIAS  ;// 8,
	case D3DSAMP_MAXMIPLEVEL: return DIS_SAMP_MAXMIPLEVEL    ;// 9,
	case D3DSAMP_MAXANISOTROPY: return DIS_SAMP_MAXANISOTROPY  ;// 10,
	case D3DSAMP_SRGBTEXTURE: return DIS_SAMP_SRGBTEXTURE    ;// 11,
	case D3DSAMP_ELEMENTINDEX: return DIS_SAMP_ELEMENTINDEX   ;// 12,
	case D3DSAMP_DMAPOFFSET: return DIS_SAMP_DMAPOFFSET     ;// 13,
	}*/
}

DIS_SCANLINEORDERING DIS_D3DConversion::ScanlineOrdering( D3DSCANLINEORDERING t )
{
	return this->D3DtoDIS_ScanlineOrdering[ t ];
	/*switch(t)
	{
	case D3DSCANLINEORDERING_PROGRESSIVE: return DIS_SCANLINEORDERING_PROGRESSIVE ;// = 1,
	case D3DSCANLINEORDERING_INTERLACED: return DIS_SCANLINEORDERING_INTERLACED ;//  = 2
	default: return DIS_SCANLINEORDERING_PROGRESSIVE ;//= 0,

	}*/
}

UInt32 DIS_D3DConversion::dShadeMode( D3DSHADEMODE t )
{
	UInt32 retVal = 0;
	if( t & D3DSHADE_FLAT )
	{
		retVal |= DIS_SHADE_FLAT;
	}
	if( t & D3DSHADE_GOURAUD )
	{
		retVal |= DIS_SHADE_GOURAUD ;
	}
	if( t & D3DSHADE_PHONG )
	{
		retVal |= DIS_SHADE_PHONG;
	}
	return retVal;
//	return this->D3DtoDIS_ShadeMode[ t ];
	/*switch(t)
	{
	
	case D3DSHADE_FLAT: return DIS_SHADE_FLAT         ;// 1,
	case D3DSHADE_GOURAUD: return DIS_SHADE_GOURAUD      ;// 2,
	case D3DSHADE_PHONG: return DIS_SHADE_PHONG        ;// 3,

	default: return DIS_SHADE_GOURAUD;// 
	}*/
}

DIS_STATEBLOCKTYPE DIS_D3DConversion::dStateBlockType( D3DSTATEBLOCKTYPE t )
{
	return this->D3DtoDIS_StateBlockType[ t ];
	/*switch(t)
	{
	case D3DSBT_ALL: return DIS_SBT_ALL          ;// 1,
	case D3DSBT_PIXELSTATE: return DIS_SBT_PIXELSTATE   ;// 2,
	case D3DSBT_VERTEXSTATE: return DIS_SBT_VERTEXSTATE  ;// 3,
	default: return DIS_SBT_ALL;  
	}*/
}

DIS_STENCILOP DIS_D3DConversion::dStencilOp( D3DSTENCILOP t )
{
	return this->D3DtoDIS_StencilOp[ t ];
	/*switch(t)
	{
	case D3DSTENCILOP_KEEP: return DIS_STENCILOP_KEEP         ;// 1,
	case D3DSTENCILOP_ZERO: return DIS_STENCILOP_ZERO         ;// 2,
	case D3DSTENCILOP_REPLACE: return DIS_STENCILOP_REPLACE      ;// 3,
	case D3DSTENCILOP_INCRSAT: return DIS_STENCILOP_INCRSAT      ;// 4,
	case D3DSTENCILOP_DECRSAT: return DIS_STENCILOP_DECRSAT      ;// 5,
	case D3DSTENCILOP_INVERT: return DIS_STENCILOP_INVERT       ;// 6,
	case D3DSTENCILOP_INCR: return DIS_STENCILOP_INCR         ;// 7,
	case D3DSTENCILOP_DECR: return DIS_STENCILOP_DECR         ;// 8,
	default: return DIS_STENCILOP_KEEP          ;// 0,
	}*/
}

DIS_SWAPEFFECT DIS_D3DConversion::dSwapEffect( D3DSWAPEFFECT t )
{
	return this->D3DtoDIS_SwapEffect[ t ];
	/*switch(t)
	{
	
	case D3DSWAPEFFECT_DISCARD: return  DIS_SWAPEFFECT_DISCARD      ;// 1,
	case D3DSWAPEFFECT_FLIP: return DIS_SWAPEFFECT_FLIP         ;// 2,
	case D3DSWAPEFFECT_COPY: return DIS_SWAPEFFECT_COPY         ;// 3,
	case D3DSWAPEFFECT_OVERLAY: return DIS_SWAPEFFECT_OVERLAY      ;// 4,
	case D3DSWAPEFFECT_FLIPEX: return DIS_SWAPEFFECT_FLIPEX       ;// 5,
	default: return DIS_SWAPEFFECT_DISCARD;// 0,
	}*/
}

DIS_TEXTUREADDRESS DIS_D3DConversion::dTextureAddress( D3DTEXTUREADDRESS t )
{
	return this->D3DtoDIS_TextureAddress[ t ];
	/*switch(t)
	{
	
	case D3DTADDRESS_WRAP: return DIS_TADDRESS_WRAP         ;// 1,
	case D3DTADDRESS_MIRROR: return DIS_TADDRESS_MIRROR       ;// 2,
	case D3DTADDRESS_CLAMP: return DIS_TADDRESS_CLAMP        ;// 3,
	case D3DTADDRESS_BORDER: return DIS_TADDRESS_BORDER       ;// 4,
	case D3DTADDRESS_MIRRORONCE: return DIS_TADDRESS_MIRRORONCE   ;// 5,
	default : return DIS_TADDRESS_WRAP       ;// 0,
	}*/
}


DIS_TEXTUREFILTERTYPE DIS_D3DConversion::dTextureFilter( D3DTEXTUREFILTERTYPE t )
{
	return this->D3DtoDIS_TextureFilterType[ t ];
	/*switch(t)
	{
	case D3DTEXF_NONE: return DIS_TEXF_NONE             ;// 0,
	case D3DTEXF_POINT: return DIS_TEXF_POINT            ;// 1,
	case D3DTEXF_LINEAR: return DIS_TEXF_LINEAR           ;// 2,
	case D3DTEXF_ANISOTROPIC: return DIS_TEXF_ANISOTROPIC      ;// 3,
	case D3DTEXF_PYRAMIDALQUAD: return DIS_TEXF_PYRAMIDALQUAD    ;// 4,
	case D3DTEXF_GAUSSIANQUAD: return DIS_TEXF_GAUSSIANQUAD     ;// 5,
	case D3DTEXF_CONVOLUTIONMONO: return DIS_TEXF_CONVOLUTIONMONO  ;// 6,
	default: return DIS_TEXF_NONE;
	}
	*/
}

DIS_TEXTUREOP DIS_D3DConversion::dTextureOp( D3DTEXTUREOP t )
{
	return this->D3DtoDIS_TextureOp[ t ];
/*
	switch(t)
	{
	case D3DTOP_DISABLE: return DIS_TOP_DISABLE                    ;// 1,
	case D3DTOP_SELECTARG1: return DIS_TOP_SELECTARG1                 ;// 2,
	case D3DTOP_SELECTARG2: return DIS_TOP_SELECTARG2                 ;// 3,
	case D3DTOP_MODULATE: return DIS_TOP_MODULATE                   ;// 4,
	case D3DTOP_MODULATE2X: return DIS_TOP_MODULATE2X                 ;// 5,
	case D3DTOP_MODULATE4X: return DIS_TOP_MODULATE4X                 ;// 6,
	case D3DTOP_ADD: return DIS_TOP_ADD                        ;// 7,
	case D3DTOP_ADDSIGNED: return DIS_TOP_ADDSIGNED                  ;// 8,
	case D3DTOP_ADDSIGNED2X: return DIS_TOP_ADDSIGNED2X                ;// 9,
	case D3DTOP_SUBTRACT: return DIS_TOP_SUBTRACT                   ;// 10,
	case D3DTOP_ADDSMOOTH: return DIS_TOP_ADDSMOOTH                  ;// 11,
	case D3DTOP_BLENDDIFFUSEALPHA: return DIS_TOP_BLENDDIFFUSEALPHA          ;// 12,
	case D3DTOP_BLENDTEXTUREALPHA: return DIS_TOP_BLENDTEXTUREALPHA          ;// 13,
	case D3DTOP_BLENDFACTORALPHA: return DIS_TOP_BLENDFACTORALPHA           ;// 14,
	case D3DTOP_BLENDTEXTUREALPHAPM: return DIS_TOP_BLENDTEXTUREALPHAPM        ;// 15,
	case D3DTOP_BLENDCURRENTALPHA: return DIS_TOP_BLENDCURRENTALPHA          ;// 16,
	case D3DTOP_PREMODULATE: return DIS_TOP_PREMODULATE                ;// 17,
	case D3DTOP_MODULATEALPHA_ADDCOLOR: return DIS_TOP_MODULATEALPHA_ADDCOLOR     ;// 18,
	case D3DTOP_MODULATECOLOR_ADDALPHA: return DIS_TOP_MODULATECOLOR_ADDALPHA     ;// 19,
	case D3DTOP_MODULATEINVALPHA_ADDCOLOR: return DIS_TOP_MODULATEINVALPHA_ADDCOLOR  ;// 20,
	case D3DTOP_MODULATEINVCOLOR_ADDALPHA: return DIS_TOP_MODULATEINVCOLOR_ADDALPHA  ;// 21,
	case D3DTOP_BUMPENVMAP: return DIS_TOP_BUMPENVMAP                 ;// 22,
	case D3DTOP_BUMPENVMAPLUMINANCE: return DIS_TOP_BUMPENVMAPLUMINANCE        ;// 23,
	case D3DTOP_DOTPRODUCT3: return DIS_TOP_DOTPRODUCT3                ;// 24,
	case D3DTOP_MULTIPLYADD: return DIS_TOP_MULTIPLYADD                ;// 25,
	case D3DTOP_LERP: return DIS_TOP_LERP                       ;// 26,
	default : return DIS_TOP_DISABLE ;// 0,
	}*/
}

DIS_TEXTURESTAGESTATETYPE DIS_D3DConversion::dTextureStageState( D3DTEXTURESTAGESTATETYPE t )
{
	return this->D3DtoDIS_TextureStageStateType[ t ];
	/*switch(t)
	{
	
	case D3DTSS_COLOROP: return DIS_TSS_COLOROP                ;// 1;
	case D3DTSS_COLORARG1: return DIS_TSS_COLORARG1              ;// 2;
	case D3DTSS_COLORARG2: return DIS_TSS_COLORARG2              ;// 3;
	case D3DTSS_ALPHAOP: return DIS_TSS_ALPHAOP                ;// 4;
	case D3DTSS_ALPHAARG1: return DIS_TSS_ALPHAARG1              ;// 5;
	case D3DTSS_ALPHAARG2: return DIS_TSS_ALPHAARG2              ;// 6;
	case D3DTSS_BUMPENVMAT00: return DIS_TSS_BUMPENVMAT00           ;// 7;
	case D3DTSS_BUMPENVMAT01: return DIS_TSS_BUMPENVMAT01           ;// 8;
	case D3DTSS_BUMPENVMAT10: return DIS_TSS_BUMPENVMAT10           ;// 9;
	case D3DTSS_BUMPENVMAT11: return DIS_TSS_BUMPENVMAT11           ;// 10;
	case D3DTSS_TEXCOORDINDEX: return DIS_TSS_TEXCOORDINDEX          ;// 11;
	case D3DTSS_BUMPENVLSCALE: return DIS_TSS_BUMPENVLSCALE          ;// 22;
	case D3DTSS_BUMPENVLOFFSET: return DIS_TSS_BUMPENVLOFFSET         ;// 23;
	case D3DTSS_TEXTURETRANSFORMFLAGS: return DIS_TSS_TEXTURETRANSFORMFLAGS  ;// 24;
	case D3DTSS_COLORARG0: return DIS_TSS_COLORARG0              ;// 26;
	case D3DTSS_ALPHAARG0: return DIS_TSS_ALPHAARG0              ;// 27;
	case D3DTSS_RESULTARG: return DIS_TSS_RESULTARG              ;// 28;
	case D3DTSS_CONSTANT: return DIS_TSS_CONSTANT               ;// 32;
	default : return DIS_TSS_COLOROP ;// 0;
	}*/
}

DIS_TEXTURETRANSFORMFLAGS DIS_D3DConversion::dTextureTransformFlag( D3DTEXTURETRANSFORMFLAGS t )
{
	return this->D3DtoDIS_TextureTransformFlags[ t ];
	/*switch(t)
	{
	case D3DTTFF_DISABLE: return DIS_TTFF_DISABLE      ;// 0,
	case D3DTTFF_COUNT1: return DIS_TTFF_COUNT1       ;// 1,
	case D3DTTFF_COUNT2: return DIS_TTFF_COUNT2       ;// 2,
	case D3DTTFF_COUNT3: return DIS_TTFF_COUNT3       ;// 3,
	case D3DTTFF_COUNT4: return DIS_TTFF_COUNT4       ;// 4,
	case D3DTTFF_PROJECTED: return DIS_TTFF_PROJECTED    ;// 5,
	default: return DIS_TTFF_DISABLE;
	}*/
}

DIS_TRANSFORMSTATETYPE DIS_D3DConversion::dTransformState( D3DTRANSFORMSTATETYPE t )
{
	return this->D3DtoDIS_TransformStateType[ t ];
	/*switch(t)
	{
	
	case D3DTS_WORLD: return DIS_TS_WORLD;
	case D3DTS_VIEW: return DIS_TS_VIEW        ;// 2,
	case D3DTS_PROJECTION: return DIS_TS_PROJECTION   ;// 3,
	case D3DTS_TEXTURE0: return DIS_TS_TEXTURE0     ;// 16,
	case D3DTS_TEXTURE1: return DIS_TS_TEXTURE1     ;// 17,
	case D3DTS_TEXTURE2: return DIS_TS_TEXTURE2     ;// 18,
	case D3DTS_TEXTURE3: return DIS_TS_TEXTURE3     ;// 19,
	case D3DTS_TEXTURE4: return DIS_TS_TEXTURE4     ;// 20,
	case D3DTS_TEXTURE5: return DIS_TS_TEXTURE5     ;// 21,
	case D3DTS_TEXTURE6: return DIS_TS_TEXTURE6     ;// 22,
	case D3DTS_TEXTURE7: return DIS_TS_TEXTURE7     ;// 23,
	default: return DIS_TS_WORLD;
	}*/
}

DIS_VERTEXBLENDFLAGS DIS_D3DConversion::dVertexBlendFlags( D3DVERTEXBLENDFLAGS t )
{
	return this->D3DtoDIS_VertexBlendFlags[ t ];
	/*switch(t)
	{
	case D3DVBF_DISABLE: return DIS_VBF_DISABLE   ;// 0,
	case D3DVBF_1WEIGHTS: return DIS_VBF_1WEIGHTS  ;// 1,
	case D3DVBF_2WEIGHTS: return DIS_VBF_2WEIGHTS  ;// 2,
	case D3DVBF_3WEIGHTS: return DIS_VBF_3WEIGHTS  ;// 3,
	case D3DVBF_TWEENING: return DIS_VBF_TWEENING  ;// 4,
	case D3DVBF_0WEIGHTS: return DIS_VBF_0WEIGHTS  ;// 5
	default: return DIS_VBF_DISABLE;
	}*/
}

DIS_ZBUFFERTYPE DIS_D3DConversion::dZBufferType( D3DZBUFFERTYPE t )
{
	return this->D3DtoDIS_ZBufferType[ t ];
/*	switch(t)
	{
	case D3DZB_FALSE: return DIS_ZB_FALSE;//        = 0,
	case D3DZB_TRUE: return DIS_ZB_TRUE;//         = 1,
	case D3DZB_USEW: return DIS_ZB_USEW;//         = 2,
	default: return DIS_ZB_TRUE;
	}
*/
}

DIS_USAGE DIS_D3DConversion::dUsage( int t )
{
	//return this->D3DtoDIS_Usage[ t ];
	switch(t)
	{
	case D3DUSAGE_AUTOGENMIPMAP: return DIS_USAGE_AUTOGENMIPMAP;
	case D3DUSAGE_DEPTHSTENCIL: return DIS_USAGE_DEPTHSTENCIL;
	case D3DUSAGE_DMAP: return DIS_USAGE_DMAP;
	case D3DUSAGE_DONOTCLIP: return DIS_USAGE_DONOTCLIP;
	case D3DUSAGE_DYNAMIC: return DIS_USAGE_DYNAMIC;
	case D3DUSAGE_NONSECURE: return DIS_USAGE_NONSECURE;
	case D3DUSAGE_NPATCHES: return DIS_USAGE_NPATCHES;
	case D3DUSAGE_POINTS: return DIS_USAGE_POINTS;
	case D3DUSAGE_RENDERTARGET: return DIS_USAGE_RENDERTARGET;
	case D3DUSAGE_RTPATCHES: return DIS_USAGE_RTPATCHES;
	case D3DUSAGE_SOFTWAREPROCESSING: return DIS_USAGE_SOFTWAREPROCESSING;
	case D3DUSAGE_TEXTAPI: return DIS_USAGE_TEXTAPI;
	case D3DUSAGE_WRITEONLY: return DIS_USAGE_WRITEONLY;
	case D3DUSAGE_RESTRICTED_CONTENT: return DIS_USAGE_RESTRICTED_CONTENT;
	case D3DUSAGE_RESTRICT_SHARED_RESOURCE: return DIS_USAGE_RESTRICT_SHARED_RESOURCE;
	case D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER: return DIS_USAGE_RESTRICT_SHARED_RESOURCE_DRIVER;
	default: return DIS_USAGE_AUTOGENMIPMAP;
	}
}